[nSLUG] Any Perl Experience around?

Joel Maxuel j.maxuel at gmail.com
Thu Jun 22 06:50:06 ADT 2017


Off the top of my head, are the classification codes:

/ (Blue)
* (Lime)
~ (Magenta)

...because I cannot remember there being more symbols but I do recall more
colourization than four.  And my test directory, used colour more often
within the types than the use of the codes (except for the directory
marking which was probably the same).

At any rate, I can think of a Case logic within the string (wherever it may
be) to identify the class code.  Not sure how that lays out on paper though.

Looks simpler at this point.

Cheers,
Joel Maxuel

On Jun 22, 2017 1:05 AM, "Mike Spencer" <mspencer at tallships.ca> wrote:

>
> > ls -F --color | perl -lne 's/(.{24}).*/$1... /s ; print' | column -x
> >
> > [and other variants...]
>
> Use ls -F, pipe to perl, parse the classification chars in perl and
> add colour codes yourself in the perl print statement.  (Note that ls
> doesn't colorize the classification chars which you can elide or not
> as you like.)
>
> See man 4 console_codes, page down to ECMA-48 for the codes.  Run ls
> --color in an Emacs shell buffer (dumb terminal) to see which ones ls
> normally uses and how multiple codes are concatenated with ';'.
> (E.g. directory names are coded for both blue and bold.)
>
> Easier than trying to write a regexp to manipulate the raw ls --color
> output.
>
>
> FWIW,
> - Mike
>
> --
> Michael Spencer                  Nova Scotia, Canada       .~.
>                                                            /V\
> mspencer at tallships.ca                                     /( )\
> http://home.tallships.ca/mspencer/                        ^^-^^
> _______________________________________________
> 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/7df93bb1/attachment-0001.html>


More information about the nSLUG mailing list