From owner-freebsd-questions@FreeBSD.ORG Tue Dec 11 20:21: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 8AC5D16A419 for ; Tue, 11 Dec 2007 20:21:37 +0000 (UTC) (envelope-from maslak@ihlas.net.tr) Received: from pop3.ihlas.net.tr (smtp.ihlas.net.tr [213.238.128.249]) by mx1.freebsd.org (Postfix) with SMTP id 7897513C43E for ; Tue, 11 Dec 2007 20:21:35 +0000 (UTC) (envelope-from maslak@ihlas.net.tr) Received: (qmail 11151 invoked by uid 89); 11 Dec 2007 20:21:35 -0000 X-Mail-Scanner: Scanned by qSheff-II-2.1 (http://www.enderunix.org/qsheff/) Received: from unknown (HELO ihlasnetym) (213.238.150.220) by 0 with SMTP; 11 Dec 2007 20:21:34 -0000 Message-ID: <001001c83c33$669b46b0$dc96eed5@ihlasnetym> From: "Halid Faith" To: References: <002801c83c11$cd434e70$dc96eed5@ihlasnetym> <475EC318.90104@dial.pipex.com> Date: Tue, 11 Dec 2007 22:21:22 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Subject: Re: How to replace two strings in a file in the same time with 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: Tue, 11 Dec 2007 20:21:37 -0000 Ok But I have another problem, I couldn't use any command interior of sed command. That's to say I have a script; yy="file5" for i in `cat file1`; do sed -e 's/old1/new1\ \'$i'/g' -e 's/old2/'cut -d, -f 1 ${yy}'/g' file2 > file3 done When I run the script, I get an error, due to using cut command > Do you mean something like: > > sed -e 's/string1/replacement1/g' -e 's/string2/replacement2/g' > > or > > sed -f instructions.sed > > instructions.sed: > > s/string1/replacement1/g > s/string2/replacement2/g > > --Alex > >