Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using SED to create a directory

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
I have a file: 12345-6789A.prt
I would like to create a directory: 12345-6789+A/

If I have 50 similarily named files (#####-####X.prt) I would like to create 50 directories.

I think I can use sed, for example:

for file in *;
do mkdir `echo $file | sed 's/'$1'/'$2'/g'` ;
done

where $1 is "12345-6789" and $2 is "12345-6789+", but I don't know how to make $1 and $2 be what I want.

Can someone help?

Thanks,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor