From owner-freebsd-questions@FreeBSD.ORG Wed Nov 10 23:04:30 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 DA2AA16A4CE for ; Wed, 10 Nov 2004 23:04:30 +0000 (GMT) Received: from fri.itea.ntnu.no (fri.itea.ntnu.no [129.241.7.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5477143D41 for ; Wed, 10 Nov 2004 23:04:30 +0000 (GMT) (envelope-from svein-freebsd-questions@theloosingend.net) Received: from localhost (localhost [127.0.0.1]) by fri.itea.ntnu.no (Postfix) with ESMTP id 345288068 for ; Thu, 11 Nov 2004 00:04:29 +0100 (CET) Received: from mirrorball.thelosingend.net (m069c.studby.ntnu.no [129.241.130.69]) by fri.itea.ntnu.no (Postfix) with SMTP for ; Thu, 11 Nov 2004 00:04:26 +0100 (CET) Received: (qmail 23407 invoked from network); 10 Nov 2004 23:04:26 -0000 Received: from m190d.studby.ntnu.no (129.241.131.190) by m069c.studby.ntnu.no with QMQP; 10 Nov 2004 23:04:26 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 10 Nov 2004 23:04:17 -0000 Date: Thu, 11 Nov 2004 00:04:17 +0100 (CET) From: Svein Halvor Halvorsen X-X-Sender: sveinhal@maren.thelosingend.net To: Rod Person In-Reply-To: <200411101443.01977.personrp@hotpop.com> Message-ID: <20041111000034.C7304@maren.thelosingend.net> References: <200411101443.01977.personrp@hotpop.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Content-Scanned: with sophos and spamassassin at mailgw.ntnu.no. cc: freebsd-questions@freebsd.org Subject: Re: Sed Help..... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2004 23:04:31 -0000 [Rod Person, 2004-11-10] > Here is the relavent code: > > KDMLINE="/usr/local/bin/kdm -nodaemon" > REPLACELINE="/usr/X11R6/bin/xdm -nodaemon" > > sed -e "s/$REPLACELINE/$KDMLINE/g" /etc/test/ttys > /etc/test/new > > Here is the error I'm getting: > sed: 1: "s//usr/X11R6/bin/xdm -n ...": bad flag in substitute command: 'X' > I was just made aware of a really nice feature of sed just yesterday: You can replace the / as a seperator with whatever character you want, as long as you use that same character all the way!! This is really nice, since you wouldn't need to escape the / characters as you otherwise would need to do. Just do like this (for instance): sed -2 s_$REPLACELINE_$KDMLIME_g /etc/test/ttys > /etc/test/new