extract string from filename
Python
python at venix.com
Thu Jan 12 20:28:01 EST 2006
On Thu, 2006-01-12 at 19:40 -0500, Zhao Peng wrote:
> For example:
> abc_st_nh_num.sas7bdat
> abc_st_vt_num.sas7bdat
> abc_st_ma_num.sas7bdat
> abcd_region_NewEngland_num.sas7bdat
> abcd_region_South_num.sas7bdat
You're not the only one learning here.
I put these names into a file called str2-test-data
$ cut -d _ -f 2 str2-test-data | sort | uniq
region
st
I think that you could use:
ls | cut -d _ -f 2 | sort | uniq > str2-results.txt
--
Lloyd Kvam
Venix Corp
More information about the gnhlug-discuss
mailing list