On Wed, Dec 12, 2007, Halid Faith wrote:
>I have a file named file1 which contains some values.
>I want to replace some strings into it, so I use sed command but I get an 
>sed "s#oldstring#`cut -d, -f3 file2`#"  file1
>sed: 1: "s/yenidomain2/f0b2875d- ...": unterminated substitute in regular 
>also I get an error with awk command into sed;
>sed "s#oldstring#`awk -F, '{print$3}' file2`#"    file1
>sed: 1: "s#yenidomain2#f0b2875d- ...": unterminated substitute in regular 

The ``cut -d...` may well be biting you with multiple lines or
extra line feeds.  You might see the problem by prefixing your
command with ``echo'' to see what it's actually doing.

echo sed "s#oldstring#`cut -d, -f3 file2`#"  file1

I usually do more complex substitutions with short python or perl
scripts as (a) they use a common regular expression syntax, and
(b) I find the code cleaner (at least the python :-)

INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

Scientists are explorers. Philosophers are tourists. -- Richard Feynman
freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to