LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   sed matching an apostrophe (https://www.linuxquestions.org/questions/linux-general-1/sed-matching-an-apostrophe-439625/)

dazdaz 04-28-2006 03:39 AM

sed matching an apostrophe
 
Hi there,

I'd like to figure out to get sed to match an apostrophe.

I am trying the following which does'nt match.

It's my understanding the 048 is the ascii code for an apostrophe but this may be wrong.

~> echo "abc'" | sed 's/'`echo "\048"`'/xyz/g'
abc'

Would appreciate some tips. I took a look in the sed faq and some others places and I can't find the answer.

Thanks.

dazdaz 04-28-2006 03:50 AM

~> echo "abc'" | sed 's/'"'"'/xyz/g'
abcxyz

lol that did it :-)

Tinkster 04-28-2006 05:24 PM

echo "abc'" | sed "s/'/xyz/g"

;}


Cheers,
Tink


All times are GMT -5. The time now is 07:17 AM.