Re: [gentoo-user] Multi-file search & replace of text

2010-03-01 Thread Helmut Jarausch
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/' f

Re: [gentoo-user] Multi-file search & replace of text

2010-02-28 Thread stosss
On Sun, Feb 28, 2010 at 4:41 PM, Stroller wrote: > > On 28 Feb 2010, at 19:06, Etaoin Shrdlu wrote: >> >> On Sunday 28 February 2010, Stroller wrote: >>> >>> ... >>>  $ sed 's/Project Gutenberg/Wordsworth Classics/' foo > bar >>>  $ mv bar foo >>>  $ >> >> Have a look at sed's "-i" option. >> >>>

Re: [gentoo-user] Multi-file search & replace of text

2010-02-28 Thread Etaoin Shrdlu
On Sunday 28 February 2010, Stroller wrote: > > A starting point could be (after you make a backup of the whole tree) > > > > find /basedir -type f -exec sed -i 's/foo/bar/g' {} + > > Many thanks - that looks great! > > My only concern is that it is unreliable enough that you state the > need to

Re: [gentoo-user] Multi-file search & replace of text

2010-02-28 Thread Stroller
On 28 Feb 2010, at 19:06, Etaoin Shrdlu wrote: On Sunday 28 February 2010, Stroller wrote: ... $ sed 's/Project Gutenberg/Wordsworth Classics/' foo > bar $ mv bar foo $ Have a look at sed's "-i" option. Using `grep` I can search *recursively* through directories to find the text I'm

Re: [gentoo-user] Multi-file search & replace of text

2010-02-28 Thread Etaoin Shrdlu
On Sunday 28 February 2010, Stroller wrote: > 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/

[gentoo-user] Multi-file search & replace of text

2010-02-28 Thread Stroller
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 `g