1827439 Members
6566 Online
109965 Solutions
New Discussion

sed help...

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

sed help...

Can you sed multiple strings in a file?
What I would like to do this the following:

sed s/this/that/g and(&) s/him/her/g file >newfile

Thanks,
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: sed help...

Hi Sally:

# sed -e s/this/that/g -e s/him/her/g file > newfile

Regards!

...JRF...
Coolmar
Esteemed Contributor

Re: sed help...

Found the answer

sed -e 's/this/that/g' -e 's/him/her/g' file >newfile
Coolmar
Esteemed Contributor

Re: sed help...

Found the answer

sed -e 's/this/that/g' -e 's/him/her/g' file >newfile
spex
Honored Contributor

Re: sed help...

Sally,

This syntax:

sed 's/this/that/g; s/him/her/g' file > newfile

also works.

PCS