Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2007 03:12:48 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
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:  <20071213011248.GA2602@kobe.laptop>
In-Reply-To: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym>
References:  <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-12-12 23:19, Halid Faith <maslak@ihlas.net.tr> 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 error.
>
> sed "s#oldstring#`cut -d, -f3 file2`#"  file1
> sed: 1: "s/yenidomain2/f0b2875d- ...": unterminated substitute in regular expression

That's not enough information to help you in a meaningful manner.

* What does `file2' have to do with the replacement strings, and why do
  you use it?

* What are the contents of both files?

* What do you want to replace, and what should it be replaced with?

> 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

That's not very different from the cut-based command.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071213011248.GA2602>