I'm trying to replace all double quotes in a string with single quotes. here my expression:
echo "<a href=\"#\" id=\"resendActivationMailLink\">here</a>" | sed "s/\"/'/"
unfortunately only the first double quote is replaced :S
<a href='#" id="resendActivationMailLink">here</a>
any Ideas?
In America, Canada, Australia and New Zealand, the general rule is that double quotes are used to denote direct speech. Single quotes are used to enclose a quote within a quote, a quote within a headline, or a title within a quote.
The short answer is that it depends on the country that you are writing in. In British and Australian English, one typically uses single quotes. If you're writing in North America, double quote marks are typically used.
Backspace over the double quotes and then type a single quote.
If you want to add double quotes(") to String, then you can use String's replace() method to replace double quote(") with double quote preceded by backslash(\").
You need to pass the g
flag to sed
:
sed "s/\"/'/g"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With