sorting pathnames by basename

Michael O'Donnell mod+gnhlug at std.com
Mon Aug 19 16:48:07 EDT 2002


>[pause to pull-start the 500cc swiss-army chainsaw...]
>
>perl -e 'print map { $_->[0], "\n" } sort { $a->[1] cmp $b->[1] } map { [$_, @{ chomp; m#/[^/]*$#}[0]] } <ARGV>'
>
>Hope this helps,


Thank you.  I think.  For the benefit of those
here assembled, please supply an explanation.

BTW, this is actually a fairly good example of
why my immune system always concludes that I'm
in physical danger when perl code is visible...




More information about the gnhlug-discuss mailing list