sorting pathnames by basename

bscott at ntisys.com bscott at ntisys.com
Mon Aug 19 16:52:55 EDT 2002


On Mon, 19 Aug 2002, at 3:46pm, Michael O'Donnell wrote:
> My current approach is a bit clunky but works as long as the pathnames in
> question contain no spaces, thus:
>
> sed -e 's;/\([^/]*\)$; \1;' | sort -bfd +1 | sed -e 's; ;/;'
  
  Suggestion: Use a star (*) instead of a space.  Filenames containing
spaces are not uncommon, while filenames containing shell meta-characters
are still decidedly rare.

-- 
Ben Scott <bscott at ntisys.com>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |







More information about the gnhlug-discuss mailing list