Bulk Rename in Unix Using sed
5 October 2005, mid-afternoon
You can use the stream editor sed to do some useful things. For example, say you had just built and compiled a newer version of gcc, and want to rename all of these new gcc binaries from their default names to names that include the programs version suffix. You can do so using a simple comand like: for file in * ; do echo $file; cp $file `echo $file | sed 'some regex magic'`; done
. Regex magic should be of the form '/pattern1/pattern2/'
. Well perhaps that isn’t so simple, but you get the idea.