On 28 Feb, Stroller wrote: > Hi there, > > If I want to automagically replace text in a file, I can use `sed`. I don't > believe that `sed` can be invoked in such a way to change the file in place, > therefore two commands are necessary: > > $ sed 's/Project Gutenberg/Wordsworth Classics/' foo > bar > $ mv bar foo > $ > > Using `grep` I can search *recursively* through directories to find the text > I'm looking for. EG: `grep -R Gutenberg ~` > > I would like to find every instance of $foo in a directory hierarchy and > replace it with $bar. > > Is there any tool that will combine all these operations for me? > > If not, what is the best way to string together grep and sed so that they'll > do what I want? >
You might have a look at an old program which is still quite useful The link in the following web page is broken! http://centoshacker.com/kabir/utility/global-search-and-replace-using-the-fgres-utility.html Download from http://wiki.uni-konstanz.de/pitz/fgres.html Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany