Erik Price wrote:
>#!/usr/bin/python
>#
># basenamesort.py
>#
># Unix-style filter that sorts a newline-separated
># list of files by the file basename
>#
># Example usage: cat files.txt | basenamesort.py
>
>import sys
>import os
>
>tempDict = {}
>
>for line in sys.stdin.xreadlines():
> tempDict[os.path.basename(line)] = line.rstrip()
>
>sorted = tempDict.keys()
>
>sorted.sort()
>
>for key in sorted:
> print tempDict[key]
Wow. That doesn't suck. Thanks!
_______________________________________________
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
- sorting pathnames by basename Michael O'Donnell
- Re: sorting pathnames by basename pll
- Re: sorting pathnames by basename Michael O'Donnell
- Re: sorting pathnames by basename Bill Freeman
- Re: sorting pathnames by basename Kevin D. Clark
- Re: sorting pathnames by basename Erik Price
- Re: sorting pathnames by basename Erik Price
- Re: sorting pathnames by basen... Michael O'Donnell
- Re: sorting pathnames by b... Erik Price
- Programming [was Re: sorti... pll
- Re: Programming [was Re: s... Erik Price
- Re: sorting pathnames by b... Cole Tuininga
- Re: sorting pathnames by basen... Kevin D. Clark
- Re: sorting pathnames by basename pll
- Re: sorting pathnames by basename Bill Freeman
- Python (was: sorting pathnames by basen... bscott
- Re: sorting pathnames by basename Kevin D. Clark
- Re: sorting pathnames by basename Michael O'Donnell
