Re: sed substitution that contains forward slash
- From: "Daniel B. Thurman" <dant@xxxxxxxxx>
- Date: Tue, 31 Mar 2009 17:33:16 -0700
Craig White wrote:
subtitle...fun with sedThe second fails because in the file where there is
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?
Craig
a '/' in the stream, sed sees more delimiters such as:
s//Q1500T3/CL120 DELETED/g
========^ (extra delimiter)
and so fails.
Your use of '%" as a sed delimiter works so as long as %
is not part of the sed stream.
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
- References:
- sed substitution that contains forward slash
- From: Craig White
- sed substitution that contains forward slash
- Prev by Date: Re: sed substitution that contains forward slash
- Next by Date: Re: sed substitution that contains forward slash
- Previous by thread: Re: sed substitution that contains forward slash
- Next by thread: When I send email to fedora-users list, I get emails replies from @naver.com
- Index(es):
Relevant Pages
|