Sed Help.....
Svein Halvor Halvorsen
svein-freebsd-questions at theloosingend.net
Wed Nov 10 15:04:31 PST 2004
[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
More information about the freebsd-questions
mailing list