Re: sed inplace substitution



ton de w wrote:
Hi,
I want to replace a string with another string in a lot of files:
Have the following which is halfway there:
sed -e 's/BERT/FRED/g' *
It does however write to std out and not do an in place substitution.

How can I do an in place substitution, please?

find . -type f -iname "*" | xargs -i% sed 's/BERT/FRED/g' % > %

maybe! i din't test it.

TIA

Ton


HTH,
--
Stephan Grein, <stephan at stephan minus rockt dot de>
https://stephan-rockt.de
GnuPG-Key-ID: 0xF8C275D4
FingerPrint: 5B6F 134A 189B A24D 342B 0961 8D4B 0230 F8C2 75D4
.



Relevant Pages

  • sed inplace substitution
    ... I want to replace a string with another string in a lot of files: ... Have the following which is halfway there: ... It does however write to std out and not do an in place substitution. ...
    (comp.unix.shell)
  • CfV: Text Substitution
    ... Text substitution is useful for a number of applications, ... as a string in the active currency. ... chosen as the default delimiter because it is an illegal character ... Set the string defined by c-addr1 and len1 as the text to substitute ...
    (comp.lang.forth)
  • Re: DCL question (of the day)- null byte in string symbol
    ... I have pointed out that this code was just to show the bug, ... Subject: Re: DCL question - null byte in string symbol ... Lexical substitution is a possibility. ...
    (comp.os.vms)
  • Re: performance surprise -- why?
    ... On 25 Aug 2004, Anno Siegel wrote: ... >> string to a file and counted the lengths of the lines using a simple ... The substitution method must move parts of the ... > The results show indexing and global matching in the same ballpark, ...
    (comp.lang.perl.misc)
  • Re: DCL question (of the day)- null byte in string symbol
    ... The string isn't that long. ... Note that is 7 bits of the second character, 8 bits of ... Lexical substitution is a possibility. ... The fact that command verification reflects a truncated command line ...
    (comp.os.vms)