Share your knowledge at the LQ Wiki.
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, 03:39 AM   #1
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 330

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, 03:50 AM   #2
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 330

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

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

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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 9 06-30-2016 05:30 PM
sed/awk for matching & substituition laikos Programming 3 11-22-2006 11:44 AM
Apostrophe Not Displaying Correctly On Webpage justanothersteve Linux - General 4 02-20-2006 09:43 AM
Quote/Apostrophe Key JordanF Linux - General 1 08-11-2005 02:52 PM
Linux man pages apostrophe problem??? Ynog Linux - General 1 01-07-2004 02:34 PM

All times are GMT -5. The time now is 08:16 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