On 1/13/06, Zhao Peng <[EMAIL PROTECTED]> wrote: > Is it possible to number the extracted string2?
find -name \*sas7bdat -printf '%f\n' | cut -d _ -f 2 | sort | uniq | cat -n Run that pipeline in the directory you are interested in. The find(1) command finds files, based on their name or other filesystem attributes. The "-name \*sas7bdat" part finds files with file names which match the pattern. There backslash escapes the star, to keep the shell from trying to interpret it, so find gets the star instead. The "-printf '%f\n'" part has find output just the file name, not the path. cut(1) is used to split input strings, as you know. "-d _" splits into fields, based on underscores. "-f 2" outputs the second field only, one per line. sort(1) sorts, and uniq(1) eliminates duplicate lines. "cat -n" numbers the output. -- Ben "Pay attention, there's gonna be a quiz next week" Scott _______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss