csj wrote: > Is there a tool to do a search-and-replace from the command line? > Something along the lines of: > > replace "string one" "string foo" files-to-process > > I find it a bit of a hassle to keep 100+ files open just to change an > ".html" to an ".htm." Note however that I intend to use the tool on > other text files besides runaway web pages, such as processing a list > of files to feed to tar. > > ------------------------------
I like the perl solution, because it offers "in-place" editing. Try something like that: perl -pi -e 's/foo/bar/g;' * If you want to preserve a backup you should use something like perl -pi.bak -e 's/foo/bar/g;' * See perlrun(1) for details. joachim