Results 1 to 3 of 3
Hi everyone,
I'm using sed to edit some text, and I have this code in a section.
In this example I'm trying to replace some html code with a single ...
- 02-24-2009 #1Just Joined!
- Join Date
- Jan 2009
- Location
- Halifax, NS
- Posts
- 19
Cancel character not working in this case
Hi everyone,
I'm using sed to edit some text, and I have this code in a section.
In this example I'm trying to replace some html code with a single quote character.
Thus, &rsquo => '
It doesn't cancel the rightside quote, and thus gives me an error.Code:sed 's/’/\'/g'
This code is part of a longer line, so multiple sed operations on the same line. So I tried leaving out the single quotes at the beginning and end of the operations, but also returned an error.
- 02-24-2009 #2Just Joined!
- Join Date
- Jan 2009
- Location
- Halifax, NS
- Posts
- 19
Also, I can't do
because I'm replacing the double quotes further on on the same line as well.Code:sed "s/’/'/g"
So more specifically, I need it to work for this
It replaces the double quotes fine though.Code:sed 's/’/'/g; s/”/"/g; s/“/"/g'
To make it more understandable, rsquo = right side single quote, rdquo = right side double quote, and ldquo = left side double quote.
- 02-24-2009 #3Just Joined!
- Join Date
- Jan 2009
- Location
- Halifax, NS
- Posts
- 19
I decided to work around it.
Instead of grouping all the sed commands like that, I used the -e option to group them, and then used the double quotes for the sed command that replaces the single quote.
Problem fixed.


Reply With Quote