Sed Help.....
Loren M. Lang
lorenl at alzatex.com
Tue Nov 16 01:16:30 PST 2004
On Thu, Nov 11, 2004 at 08:12:55AM +0200, Giorgos Keramidas wrote:
> On 2004-11-10 15:15, Rod Person <personrp at hotpop.com> 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!!
I'd recommend using the : because it's the least likely character to
appear in a filename since : is the seperator used in $PATH. But then
again, who would use a | in a filename!?
>
> 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.
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
--
I sense much NT in you.
NT leads to Bluescreen.
Bluescreen leads to downtime.
Downtime leads to suffering.
NT is the path to the darkside.
Powerful Unix is.
Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc
Fingerprint: B3B9 D669 69C9 09EC 1BCD 835A FAF3 7A46 E4A3 280C
More information about the freebsd-questions
mailing list