Hi, I am having a problem renaming a files using SED.
The filenames are in the following format: eg 001 - GreatPics1 (The Opening) (www.somewhere.net).jpg 002 - GreatPics2 (The Closing) (www.somewhere.net).jpg 003 - GreatPics3 (The Ending) (www.somewhere.net).jpg I am wanting to remove contents of the second parenthesis, i.e. "(www.somewhere.net)". So the files would end up like: 001 - GreatPics1 (The Opening) .jpg 002 - GreatPics2 (The Closing) .jpg 003 - GreatPics3 (The Ending) .jpg This is what I have so far. If I use this to test all is well for f in * do echo $f |sed 's:(www.somewhere.net)::' done However when I incorporate the mv command all isn't well. for f in * do chg=echo $f |sed 's:(www.somewhere.net)::' mv $f $chg done I get: bash: 001: command not found mv: target `(www.somewhere.net).jpg' is not a directory bash: 002: command not found mv: target `(www.somewhere.net).jpg' is not a directory bash: 003: command not found mv: target `(www.somewhere.net).jpg' is not a directory What am I doing wrong? Thankyou all in advance. -- View this message in context: http://www.nabble.com/File-renaming-using-SED-in-BASH-tp19598886p19598886.html Sent from the Gnu - Bash mailing list archive at Nabble.com.