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

2007-12-11 Thread Firas Kraiem
On Tuesday 11 December 2007 17:20:50 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 ? [EMAIL PROTECTED] ~ % echo foobar | sed 's/foo/goo/;s/bar/baz/' goobaz -- () ascii ribbon campaign - against html e-mail /\

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

2007-12-11 Thread Alex Zbyslaw
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 ? Do you mean something like: sed -e 's/string1/replacement1/g' -e 's/string2/replacement2/g' or sed -f instructions.sed instructions.sed: s/string1/replacement1/g

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

2007-12-11 Thread Halid Faith
Ok But I have another problem, I couldn't use any command interior of sed command. That's to say I have a script; yy=file5 for i in `cat file1`; do sed -e 's/old1/new1\ \'$i'/g' -e 's/old2/'cut -d, -f 1 ${yy}'/g' file2 file3 done When I run the script, I get an error, due to using cut

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

2007-12-11 Thread Tino Engel
Halid Faith schrieb: Ok But I have another problem, I couldn't use any command interior of sed command. That's to say I have a script; yy=file5 for i in `cat file1`; do sed -e 's/old1/new1\ \'$i'/g' -e 's/old2/'cut -d, -f 1 ${yy}'/g' file2 file3 done When I run the script, I get an

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

2007-12-11 Thread Danny Pansters
On Tuesday 11 December 2007 17:20:50 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 ? ___ freebsd-questions@freebsd.org mailing list

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

2007-12-11 Thread Trix Farrar
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.

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

2007-12-11 Thread Halid Faith
I get an error; sed: illegal option -- d usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...] here's my script for i in $(cat /usr/path/test1); do sed -e s#old1#new1\ cut -d, -f 1 ${i}# -e s#old2#cut -d, -f 3

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

2007-12-11 Thread Trix Farrar
On Tue, Dec 11, 2007 at 10:21:22PM +0200, Halid Faith wrote: Ok But I have another problem, I couldn't use any command interior of sed command. That's to say I have a script; yy=file5 for i in `cat file1`; do sed -e 's/old1/new1\ \'$i'/g' -e 's/old2/'cut -d, -f 1 ${yy}'/g' file2