One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Anthony Atkielski
A few years ago, I'm sure I came across a one-line way of replacing every occurence of one string with another in an entire directory of files (potentially including all subdirectories as well). I think it used sed or awk. Now I can't find it. The examples on the Web are all multiline scripts or

Re: One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Lowell Gilbert
Anthony Atkielski <[EMAIL PROTECTED]> writes: > A few years ago, I'm sure I came across a one-line way of replacing > every occurence of one string with another in an entire directory of > files (potentially including all subdirectories as well). I think it > used sed or awk. Now I can't find it

Re: One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Miguel Mendez
On Wed, 26 Jan 2005 16:43:25 +0100 Anthony Atkielski <[EMAIL PROTECTED]> wrote: > A few years ago, I'm sure I came across a one-line way of replacing > every occurence of one string with another in an entire directory of > files (potentially including all subdirectories as well). I think it > use

Re: One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Jerry McAllister
> > A few years ago, I'm sure I came across a one-line way of replacing > every occurence of one string with another in an entire directory of > files (potentially including all subdirectories as well). I think it > used sed or awk. Now I can't find it. The examples on the Web are all > multili

Re: One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Al Johnson
> A few years ago, I'm sure I came across a one-line way of replacing > every occurence of one string with another in an entire directory of > files (potentially including all subdirectories as well). I think it > used sed or awk. Now I can't find it. The examples on the Web are all > multiline

AW: One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Norbert Koch
Well, shell lines may be quite long ;-) Do you mean something like this sed -Ee 's/search/replace/g' -i .BAK `find . -name '*.c' -type f` > A few years ago, I'm sure I came across a one-line way of replacing > every occurence of one string with another in an entire directory of > files (potenti

Re: One-line global string replace in all files with sed (or awk?)

2005-01-26 Thread Giorgos Keramidas
On 2005-01-26 16:55, Miguel Mendez <[EMAIL PROTECTED]> wrote: > On Wed, 26 Jan 2005 16:43:25 +0100 > Anthony Atkielski <[EMAIL PROTECTED]> wrote: >> A few years ago, I'm sure I came across a one-line way of replacing >> every occurence of one string with another in an entire directory of >> files (

Re: One-line global string replace in all files with sed (or awk?)

2005-01-27 Thread Anthony Atkielski
My thanks to all who replied. I ended up using this form (I don't recall who suggested it): find . -type f | xargs sed -i '' -e 's/foo/bar/g' One problem, though: It appears that sed touches every file, resetting the last modification time, even if it didn't actually change anything. This reset

Re: One-line global string replace in all files with sed (or awk?)

2005-01-27 Thread markzero
> My thanks to all who replied. I ended up using this form (I don't > recall who suggested it): > > find . -type f | xargs sed -i '' -e 's/foo/bar/g' > > One problem, though: It appears that sed touches every file, resetting > the last modification time, even if it didn't actually change anythi

Re: One-line global string replace in all files with sed (or awk?)

2005-01-27 Thread Anthony Atkielski
Hmm ... maybe I found it: grep -R -l "xxx" /www/htdocs | xargs sed -i '' -e 's/xxx/yyy/g' Does that look okay? Seems to work in my test. -- Anthony ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-que

Re: One-line global string replace in all files with sed (or awk?)

2005-01-27 Thread markzero
> Hmm ... maybe I found it: > > grep -R -l "xxx" /www/htdocs | xargs sed -i '' -e 's/xxx/yyy/g' > > Does that look okay? Seems to work in my test. > > -- > Anthony > Looks good! Mark -- PGP: http://www.darklogik.org/pub/pgp/pgp.txt B776 43DC 8A5D EAF9 2126 9A67 A7DA 390F DEFF 9DD1 pgp3P

Re: One-line global string replace in all files with sed (or awk?)

2005-01-27 Thread Giorgos Keramidas
On 2005-01-28 06:56, Anthony Atkielski <[EMAIL PROTECTED]> wrote: > My thanks to all who replied. I ended up using this form (I don't > recall who suggested it): > > find . -type f | xargs sed -i '' -e 's/foo/bar/g' > > One problem, though: It appears that sed touches every file, resetting > the

Re: One-line global string replace in all files with sed (or awk?)

2005-01-27 Thread markzero
> find . -type f | xargs grep -l 'foo' | \ > xargs sed -i '' -e 's/foo/bar/g' > > When passed the -l option (this is a lowercase 'EL'), it will not print > the matched lines. Only the name of the files that *do* match. Then, > once you have a list of files that really do match wi

Re: One-line global string replace in all files with sed (or awk?)

2005-01-28 Thread Anthony Atkielski
Giorgos Keramidas writes: GK> grep will do. You just have to pass it the right option: GK> GK> find . -type f | xargs grep -l 'foo' | \ GK> xargs sed -i '' -e 's/foo/bar/g' GK> GK> When passed the -l option (this is a lowercase 'EL'), it will not print GK> the matched lines.

Re: One-line global string replace in all files with sed (or awk?)

2005-01-28 Thread Giorgos Keramidas
On 2005-01-28 12:04, Anthony Atkielski <[EMAIL PROTECTED]> wrote: >Giorgos Keramidas writes: >> grep will do. You just have to pass it the right option: >> >> find . -type f | xargs grep -l 'foo' | \ >> xargs sed -i '' -e 's/foo/bar/g' >> >> When passed the -l option (this is a

Re: One-line global string replace in all files with sed (or awk?)

2005-01-29 Thread Juha Saarinen
On Fri, 28 Jan 2005 17:54:06 +0200, Giorgos Keramidas <[EMAIL PROTECTED]> wrote: > I honestly feel pity for the Windows using friends I have in cases like > this. Don't do that, just point them to: http://www.microsoft.com/windows/sfu/default.asp and to: http://www.interopsystems.com/tools/ No