Austen's Blog

moon indicating dark mode
sun indicating light mode

HOWTO: Recursive search and replace on the Linux command line

September 02, 2008

The ‘traditional’ way to search and replace on the command line was to use some combination of grep/find/perl/sed etc. Which offers great flexibility but at the end of the day can turn into a right pain in order to complete a simple task. Turns out only to be a pain in the ass if you don’t know or can’t remember the correct syntax!

Recently I stumbled across rpl. (http://freshmeat.net/projects/rpl/) It’s a nice little text replacement utility which is as simple as:

rpl -R search replace *

Although rpl is easy, the other alternatives are hardly difficult. (At least once you know them)

For non-recursive search and replace try: Perl or sed. (At some point I’m sure I’ll get around to finding recursive Perl and sed alternatives.)