How to use cut or awk commands into sed command ?
Tino Engel
elrap at web.de
Wed Dec 12 13:29:30 PST 2007
Halid Faith schrieb:
> 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 error.
>
> sed "s#oldstring#`cut -d, -f3 file2`#" file1
>
> sed: 1: "s/yenidomain2/f0b2875d- ...": unterminated substitute in regular expression
>
> 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 expression
>
Sure you know what you are doing?
You are giving probably various linefeeds to your substitution (assuming
file2 has more than one line).
E.G. 'awk <...> file2' produces as many lines as there are in file2. But
the substitution in sed has to be a string-like expression with no line
feeds.
There for the "unterminated substitution" error.
Rg, Tino
More information about the freebsd-questions
mailing list