[nSLUG] Any Perl Experience around?

Robert McKay robert at mckay.com
Wed Jun 21 21:22:50 ADT 2017

On 2017-06-21 23:30, Joel Maxuel wrote:
> Hi all,
> I encountered this example script in a StackExchange question[1]:
> https://github.com/atav32/dotfiles/blob/master/bash_alias#L46
> What it does is truncates the results (by file/directory) of an ls
> statement to organize in predictable columns.
> It was not long before I thought, "why not have colour?"
> So I made a quick addition, and regretted it the rest of the night:
> ls -F --color | perl -lne 's/(.{24}).*/$1... /s ; print' | column -x

ls -F --color | perl -lne 's/(.{24}).(\x1b\[0m)/$1...$2/s ; print' | 
column -x

that appears to mostly work.. I'm not sure if it's reliable -- just 
looks for a 'color off' escape code at the end and preserves it if 


More information about the nSLUG mailing list