Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

rename list of files abc.* to abcde.*

Status
Not open for further replies.

karacharlie

Programmer
Dec 19, 2004
14
DE
Hi,
I'd like to rename several files containing the same mask, e.g.
ls:
abc.1 abc.2 abc.3 abcdef.1 abcdef.2 abcdef.3

the script should rename only abc.* to abczzz.* but not abcdef.*, i.e.
ls after script:
abczzz.1 abczzz.2 abczzz.3 abcdef.1 abcdef.2 abcdef.3

thanks
 
eval `ls abc.* | awk -F. '{printf "mv %s.%s %szzz.%s;\n",$1,$2,$1,$2}'`

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top