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
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
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
>
> 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
> 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
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
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 (
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
> 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
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
> 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
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
> 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
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.
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
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
16 matches
Mail list logo