Re: sed substitution that contains forward slash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 01 April 2009 01:11:47 David Burns wrote:
> On Tue, Mar 31, 2009 at 1:37 PM, Craig White <craigwhite@xxxxxxxxxxx> wrote:
> > subtitle...fun with sed
> >
> > I have a list of changes to make to a file...
> >
> > dc              rc
> > -------------   -------
> > 15T6145V        DELETED
> > NATL19502       DELETED
> > Q10MR11/FL12V   DELETED
> > Q1500T3/CL120   DELETED
> >
> > and things work until I get to the 3rd item which has a forward slash
> > and it fails to substitute with commands like below...
> >
> > sed -i "s%${dc}%${rc}%g" ARsalesorderdetails.csv
> > and
> > sed -i "s/${dc}/${rc}/g" ARsalesorderdetails.csv
> >
> > The latter producing error on screen...
> > sed: -e expression #1, char 17: unknown option to `s'
> >
> > While the former simply doesn't complain but doesn't make the change
> > either.
> >
> > Is there a way to coerce sed to identify & replace strings with a /
> > inside?
>
> I don't think it is sed that is giving you a problem:
>
> $ echo "Q10MR11/FL12V "|sed "s|Q10MR11/FL12V|DELETED|"
> DELETED

He didn't use | he used /. You've inadvertently offered him the solution though.



-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux