sorting pathnames by basename
Kevin D. Clark
kclark at CetaceanNetworks.com
Mon Aug 19 16:12:55 EDT 2002
mod+gnhlug at std.com (Michael O'Donnell) writes:
> Given a list of pathnames, I'd like to be able to
> sort that list by the basename of each file in the
> list
[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,
--kevin
--
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc
More information about the gnhlug-discuss
mailing list