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

Trix Farrar trix at basement.net
Tue Dec 11 14:42:13 PST 2007


On Tue, Dec 11, 2007 at 06:20:50PM +0200, Halid Faith wrote:
> I want to replace two or more strings in a file in the same time with sed command.
> How do I that ?

You can specify the "-e command" parameter multiple times on a line:

$ sed -e 's/foo/fee/g' -e 's/bar/baz/e' filename.txt

-- 
John D. "Trix" Farrar               __\\|//__               Basement.NET
trix at basement.net                   (` o-o ')   http://www.basement.net/
-----------------------------------ooO-(_)-Ooo--------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20071211/eb53df13/attachment.pgp


More information about the freebsd-questions mailing list