Bulk Rename in Unix Using sed

    5 October 2005, lunch time

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.



Don't be shy, you can comment too!

Some things to keep in mind: You can style comments using Textile. In particular, *text* will get turned into text and _text_ will get turned into text. You can post a link using the command "linktext":link, so something like "google":http://www.google.com will get turned in to google. I may erase off-topic comments, or edit poorly formatted comments; I do this very rarely.