From owner-freebsd-questions@FreeBSD.ORG Thu Dec 13 01:13:37 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 DF3E816A417 for ; Thu, 13 Dec 2007 01:13:37 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 57EA913C461 for ; Thu, 13 Dec 2007 01:13:36 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup104.ach.sch.gr [81.186.70.104]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id lBD1CwKi030212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 13 Dec 2007 03:13:10 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id lBD1CqNm002669; Thu, 13 Dec 2007 03:12:54 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id lBD1CnoC002668; Thu, 13 Dec 2007 03:12:49 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Thu, 13 Dec 2007 03:12:48 +0200 From: Giorgos Keramidas To: Halid Faith Message-ID: <20071213011248.GA2602@kobe.laptop> References: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <015f01c83d04$a1df2b20$dc96eed5@ihlasnetym> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.949, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.45, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No 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: Thu, 13 Dec 2007 01:13:38 -0000 On 2007-12-12 23:19, 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 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.