Re: xargs +sed question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 07, 2006 at 02:31:56AM +0000, Amadeus W. M. wrote:
> I'd normally ask this in comp.os.linux.misc, but my news server is not
> responding, so I'm asking it here.
> I have a bunch of files in a directory tree in which I want to replace a
> string A with string B. I'm trying to do this with xargs like so:
> grep -ri -l A . | xargs sed -e 's/A/B/g'
> and this does what I want, except, of course, that it outputs everything
> to stdout. Is there any way to pass the name of each input file as
> output for sed? 

You want the "sed -i" option, which edits files in place. (I believe this is
a GNU extension.)


-- 
Matthew Miller           mattdm@xxxxxxxxxx          <http://mattdm.org/>
Boston University Linux      ------>              <http://linux.bu.edu/>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux