From owner-freebsd-questions@FreeBSD.ORG Wed Dec 12 21:29:30 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EDC616A417 for ; Wed, 12 Dec 2007 21:29:30 +0000 (UTC) (envelope-from elrap@web.de) Received: from fmmailgate03.web.de (fmmailgate03.web.de [217.72.192.234]) by mx1.freebsd.org (Postfix) with ESMTP id 3F11F13C447 for ; Wed, 12 Dec 2007 21:29:30 +0000 (UTC) (envelope-from elrap@web.de) Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate03.web.de (Postfix) with ESMTP id F281DB84E2CD; Wed, 12 Dec 2007 22:28:43 +0100 (CET) Received: from [84.152.175.92] (helo=freebsdangel.de) by smtp07.web.de with asmtp (WEB.DE 4.108 #208) id 1J2Z8F-0000QK-00; Wed, 12 Dec 2007 22:28:43 +0100 Message-ID: <476052CA.2050802@web.de> Date: Wed, 12 Dec 2007 22:29:46 +0100 From: Tino Engel User-Agent: Thunderbird 2.0.0.6 (X11/20071110) MIME-Version: 1.0 To: Halid Faith References: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym> In-Reply-To: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: elrap@web.de X-Sender: elrap@web.de X-Provags-ID: V01U2FsdGVkX19S0boFJlLghuwJ09udpwErrPqAoSvmgGKLlO3D Gu7wvui3ob7oA/2R23IY1DO1x9U4Wq/ltrT0kHmhf6opjaZ1it n9ob9AGHo= Cc: freebsd-questions@freebsd.org Subject: Re: How to use cut or awk commands into sed command ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2007 21:29:30 -0000 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