[nSLUG] Any Perl Experience around?

Joel Maxuel j.maxuel at gmail.com
Thu Jun 22 13:08:46 ADT 2017

Thank you again.  An option is to force the column width `-c 36` and leave
a bit of white space (to kludge, preventing the escape chars being
truncated again) while at it:


Final (probably) being:
ls -F --color | perl -lne 's/((?:\e\[\d+(?:;\d+)?m)*)([^
\e]{20})[^\e]*(.*)/$1$2...$3/s; print' | column -x - c 36

This should allow for two columns in a typical setup (80 cols) or three in
mine (112 cols).  Checking my work on an online tool, that may not be the
case (due to latter issue you mention).

I will take a look tonight.  I am thinking the `\e` snippets may need to be
reverted to Roberts `\x1b` to not muck up escape scenarios not related to
colour (such as spaces), unless the colour matches above won't match to
that scenario anyway (looks like it won't).

Thanks again.

Joel Maxuel

"One should strive to achieve, not sit in bitter regret."
 - Ronan Harris / Mark Jackson

On Thu, Jun 22, 2017 at 12:46 PM, Hatem Nassrat <hnassrat at gmail.com> wrote:

> On Thu, Jun 22, 2017 at 12:39 PM, Hatem Nassrat <hnassrat at gmail.com>
> wrote:
>> it replaces the output of  /bin/ls -Fc --color quite well, it also keeps
>> the directory marker or execution asterisk marker ... BUT ... seems to mess
>> up when passed to the column command.
> The reason seems to be because the column command is counting the escape
> characters when tabulating the answer, thus causing the columns that
> contain escape characters to be longer than the others, but when printed
> those characters do not actually show up thus looking like it is
> misaligned. Also the column command uses tabs to fill space between
> columns, again explains the misalignment.
> Your problem is most likely with the column command. Also this is a long
> explanation to say my regex is solid :P
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/mailman/listinfo/nslug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nslug.ns.ca/pipermail/nslug/attachments/20170622/729b7adb/attachment.html>

More information about the nSLUG mailing list