You are not logged in.

#1 2009-04-02 04:35:43

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

Any way to do this with sed?

I would like to be able to pipe the output from locate and have sed modify the files locate finds. Is there anyway to do this?

Offline

#2 2009-04-02 04:38:47

tam1138
Member
Registered: 2007-09-10
Posts: 238

Re: Any way to do this with sed?

Depending on what exactly you want, this might do the trick:

locate foo | xargs sed -ie 's/asdfasdf/fdsafdsafdsa/'

Offline

#3 2009-04-03 15:01:04

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: Any way to do this with sed?

Or you can use a for loop:

for f in $(locate foo); do sed -i 'whatever' ${f}; done

Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#4 2009-04-03 17:00:21

mike_93
Member
Registered: 2009-01-31
Posts: 60

Re: Any way to do this with sed?

Just out of interest, what happens if you don't end it with "done"?


Double booting Arch Linux and Linux Mint
Reader of XKCD

Offline

#5 2009-04-03 17:24:11

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Any way to do this with sed?

No one can be told what would happen, you have to see it for yourself smile

Offline

Board footer

Powered by FluxBB