From owner-freebsd-questions@FreeBSD.ORG Thu Nov 11 06:13:16 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D7F3816A4CE for ; Thu, 11 Nov 2004 06:13:16 +0000 (GMT) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C72443D1D for ; Thu, 11 Nov 2004 06:13:15 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b151.otenet.gr [212.205.244.159]) iAB6D6T0020433; Thu, 11 Nov 2004 08:13:10 +0200 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.1/8.13.1) with ESMTP id iAB6CuIf001717; Thu, 11 Nov 2004 08:12:56 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.1/8.13.1/Submit) id iAB6Cts2001716; Thu, 11 Nov 2004 08:12:56 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Thu, 11 Nov 2004 08:12:55 +0200 From: Giorgos Keramidas To: Rod Person Message-ID: <20041111061255.GC1569@gothmog.gr> References: <200411101443.01977.personrp@hotpop.com> <200411101515.49950.personrp@hotpop.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200411101515.49950.personrp@hotpop.com> cc: freebsd-questions@freebsd.org Subject: Re: Sed Help..... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2004 06:13:17 -0000 On 2004-11-10 15:15, Rod Person wrote: > On Wednesday 10 November 2004 7:58 pm, mailing lists at MacTutor wrote: > > Take a look at what the shell replacement is actually doing. If you > > were to write the line manually it would look like this: > > > > sed -e 's/\/usr\X11R6\/bin\/xdm/\/usr\/local\/bin\/kdm/g' ... > > > > Right? > > > > But the shell doesn't escape the path separators (slashes). You need to > > escape them yourself in the variable assignments. Like this, > > > > KDMLINE='\/usr\/local\/bin\/kdm' > > &c > > I hate when you look at something for hours and it something you know you > should have known! I had at one point had the variables with double qoute and > even tried to escape the qoutes!! You can also use different sed-separator characters: sed -e "s|${REPLACELINE}|${KDMLINE}|" The choise of '|' is arbitrary above. It could have been '@', '#', or '!', for all that sed(1) cares. The substitution would still work.