Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2004 08:12:55 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Rod Person <personrp@hotpop.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Sed Help.....
Message-ID:  <20041111061255.GC1569@gothmog.gr>
In-Reply-To: <200411101515.49950.personrp@hotpop.com>
References:  <200411101443.01977.personrp@hotpop.com> <D8431F26-3352-11D9-91B4-000D9347C178@mactutor.biz> <200411101515.49950.personrp@hotpop.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2004-11-10 15:15, Rod Person <personrp@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!!

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041111061255.GC1569>