How to replace two strings in a file in the same time with sedcommand ?

Barry Byrne barry.byrne at wbtsystems.com
Tue Dec 11 09:00:13 PST 2007


 

> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org 
> [mailto:owner-freebsd-questions at freebsd.org] On Behalf Of Halid Faith
> Sent: 11 December 2007 16:21

> I want to replace two or more strings in a file in the same 
> time with sed command.
> How do I that ?

Halid:

You haven't said exactly what you want to do, but something like this should
get you started.


sed 's/oldstring1/newstring1/g; s/oldstring2/newstring2/g' < infile >
outfile





More information about the freebsd-questions mailing list