extract string from filename

Ben Scott dragonhawk at gmail.com
Fri Jan 13 12:21:02 EST 2006


On 1/13/06, Ben Scott <dragonhawk at gmail.com> wrote:
> On 1/13/06, Zhao Peng <greenmt at gmail.com> wrote:
> > Is it possible to number the extracted string2?
>
> find -name \*sas7bdat -printf '%f\n' | cut -d _ -f 2 | sort | uniq | cat -n

  I forgot to mention: If the *only* files in that directory are the
ones with the interesting file names, you can just use this:

ls | cut -d _ -f 2 | sort | uniq | cat -n

-- Ben "I would flunk the quiz" Scott



More information about the gnhlug-discuss mailing list