From owner-freebsd-questions@FreeBSD.ORG Wed Nov 10 23:38:57 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 1936316A4CE; Wed, 10 Nov 2004 23:38:57 +0000 (GMT) Received: from april.chuckr.org (april.chuckr.org [66.92.151.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 87A5643D49; Wed, 10 Nov 2004 23:38:56 +0000 (GMT) (envelope-from chuckr@chuckr.org) Received: from april.chuckr.org (localhost [127.0.0.1]) by april.chuckr.org (8.12.11/8.12.11) with ESMTP id iAB05bcj051590; Wed, 10 Nov 2004 19:05:37 -0500 (EST) (envelope-from chuckr@chuckr.org) Received: from localhost (chuckr@localhost)iAB05agT051585; Wed, 10 Nov 2004 19:05:36 -0500 (EST) (envelope-from chuckr@chuckr.org) X-Authentication-Warning: april.chuckr.org: chuckr owned process doing -bs Date: Wed, 10 Nov 2004 19:05:36 -0500 (EST) From: Chuck Robey To: questions@freebsd.org In-Reply-To: <20041111000034.C7304@maren.thelosingend.net> Message-ID: <20041110190348.Y25881@april.chuckr.org> References: <200411101443.01977.personrp@hotpop.com> <20041111000034.C7304@maren.thelosingend.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org cc: Rod Person 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: Wed, 10 Nov 2004 23:38:57 -0000 On Thu, 11 Nov 2004, Svein Halvor Halvorsen wrote: > > [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. Works this way with just about any system using the sed substitution syntax (for instance, vi uses it, vim does). Go looking at nearly any large Gmake script (sucu as one of the makefiles from gcc) and you'll see it all over the place. > > Just do like this (for instance): > > sed -2 s_$REPLACELINE_$KDMLIME_g /etc/test/ttys > /etc/test/new > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > ---------------------------------------------------------------------------- Chuck Robey | Interests include C & Java programming, FreeBSD, chuckr@chuckr.org | electronics, communications, and SF/Fantasy. New Year's Resolution: I will not sphroxify gullible people into looking up fictitious words in the dictionary (on the wall at my old fraternity, Signa Phi Nothing). ----------------------------------------------------------------------------