sed problem

Christofer C. Bell christofer.c.bell at gmail.com
Thu Apr 20 14:44:02 UTC 2006


On 4/19/06, wwp <subscript at free.fr> wrote:
> Hello Hans,
>
>
> On Wed, 19 Apr 2006 18:57:54 +0200 Hans Müller <ndof at gmx.li> wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > I have this sting: "/Linux/update" and I must substitute it to
> > "\/Linux\/update" I tryed echo "/Linux/update"|sed "s/\//\\\//g" but it
> > fails. have someone any ideas??
>
> You're not escaping enough.. Use: `echo "/Linux/update"|sed "s/\//\\\\\//g"`
> or even `echo "/Linux/update"|sed "s_/_\\\\/_g"`.

You don't need to escape anything, just use a different limiter:

$ echo "/Linux/update" | sed 's:/:V:g'

--
Chris

"I trust the Democrats to take away my money, which I can afford.  I
trust the Republicans to take away my freedom, which I cannot."




More information about the fedora-list mailing list