Date: Wed, 12 Dec 2007 22:29:46 +0100 From: Tino Engel <elrap@web.de> To: Halid Faith <maslak@ihlas.net.tr> Cc: freebsd-questions@freebsd.org Subject: Re: How to use cut or awk commands into sed command ? Message-ID: <476052CA.2050802@web.de> In-Reply-To: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym> References: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?476052CA.2050802>