02.06.2010
Let's suppose we have a bunch of files with filenames following the pattern:
noturgent.file1.txt noturgent.file2.txt noturgent.file3.txt
And we want to remove the first part (noturgent) or replace it with another word.
for filename in *; do cp $filename $(echo $filename | sed s/noturgent.// ); done
This will iterate all the files in the folder (we can use *.txt to make a distinction here), and then copy them with the new name. This is obtained using the old one and sed with s for substitution. If you just want to replace noturgent with urgent, for example, just fill up the second argument for sed (as in sed s/noturgent./urgent./)