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
> _______________________________________________
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
>

----------------------------------------------------------------------------
Chuck Robey         | Interests include C & Java programming, FreeBSD,
[EMAIL PROTECTED]   | 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).
----------------------------------------------------------------------------
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to