[Previous entry: "Cleaning a whiteboard?"] [Main Index] [Next entry: "Movie conversion for Mac"]
03/10/2007 Entry: "rpl - a command that should come standard on *nix"
There are plenty of ways to do batch editing of text files in unix versions...perl, sed, vim, etc. But really, they aren't all that easy to use. Therefore, I was impressed the other day to come across rpl. I'm a bit shocked that I missed this for so long...it's a perfect solution to a problem I've had for years.
From the man page:
NAME
rpl - replace strings in filesSYNOPSIS
rpl [-LhiwbqvsRepfdt] [-xSUFFIX]DESCRIPTION
Basic usage is to specify two strings and one or more filenames or directories on the command line. The first string is the string to replace, and the second string is the replacement string.
It doesn't do regexp matches, but if you need something that serious, you're better off with perl or sed anyway. What I found really nice is the dry-run mode (-s), which would have prevented me making serious mistakes in the past.
Of course, for a single file edit with lots of searches and replacements, I'm happy to use vi/vim. But if I want to do a bunch of changes, especially recursing through directories, rpl is the way to go. If you use a Debian-based system, it's likely in apt.