Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-28-2006, 04:39 AM   #1
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 323

Rep: Reputation: 17
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'

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

Old 04-28-2006, 04:50 AM   #2
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 323

Original Poster
Rep: Reputation: 17
~> echo "abc'" | sed 's/'"'"'/xyz/g'

lol that did it :-)
Old 04-28-2006, 06:24 PM   #3
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,047
Blog Entries: 11

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
echo "abc'" | sed "s/'/xyz/g"




Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 8 12-18-2013 06:36 PM
sed/awk for matching & substituition laikos Programming 3 11-22-2006 12:44 PM
Apostrophe Not Displaying Correctly On Webpage justanothersteve Linux - General 4 02-20-2006 10:43 AM
Quote/Apostrophe Key JordanF Linux - General 1 08-11-2005 03:52 PM
Linux man pages apostrophe problem??? Ynog Linux - General 1 01-07-2004 03:34 PM

All times are GMT -5. The time now is 12:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration