matching ' in sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting matching ' in sed
# 1  
Old 05-14-2009
matching ' in sed

Hi,

I need to match some text in sed that contains the ' character. I have tried a escaped character but it doesn't work (that is, something like sed 's/\'/whatever/g') Does anyone know how to specify the ' character in the left part of sed?

Thanks in advance.
# 2  
Old 05-14-2009
Quote:
Originally Posted by luisrr
Hi,

I need to match some text in sed that contains the ' character. I have tried a escaped character but it doesn't work (that is, something like sed 's/\'/whatever/g') Does anyone know how to specify the ' character in the left part of sed?

Thanks in advance.
Use double quotes:

Code:
sed "s/'/whatever/" file

Regards
# 3  
Old 05-14-2009
Quote:
Originally Posted by Franklin52
Use double quotes:

Code:
sed "s/'/whatever/" file

Regards
It works perfectly !

Thank you very much.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed matching

I need to extract text between numerous story-title=" " <trending-story id="US_lnk_swT_mwAwAABMLM_en" sparkline="story.sparkline" story-index="(pageIndex * ctrl.trendingStoriesPerPage) + storyIndex + 1" story-title="Vaccine, Zika virus" story-title-array="story.entityNames"... (2 Replies)
Discussion started by: p1ne
2 Replies

2. Shell Programming and Scripting

Use sed to get first matching pattern

HI, I have a file: listenerport: - 1521 - 10520 - 10521 - 10522 - 10523 instances: listenerport: listenerport: - 1521 - 10540 - 10541 - 10542 - 10543 instances: ... (5 Replies)
Discussion started by: netbanker
5 Replies

3. Shell Programming and Scripting

Help with sed pattern matching

Hi My log file is Testtmp2 cat Testtmp2 12:12:38 12:14:29 12:17:34 12:19:08 12:20:10 12:21:35 12:22:20 12:22:26 12:22:34 12:22:38 12:28:14 12:31:35 12:32:50 12:33:04 (3 Replies)
Discussion started by: rahkumar
3 Replies

4. Shell Programming and Scripting

help! Pattern Matching in vi or sed

I have a bunch of conf files, that contain the fully qualified names of servers. I would like to be able to use some sort of pattern matching with sed or vi, or whatever, to pull out the fully qualified server names, and dump them in a file. It just needs to work across several unix os. So, I... (4 Replies)
Discussion started by: tabini
4 Replies

5. Shell Programming and Scripting

SED pattern matching help

Hello All, I have the following lines in a file <address location="test" ConnectionName="test" /> I want to replace the above lines by <address location="test123" /> I am usind SED and not able to remove the new line characters between the two lines. Can anyone please help... (4 Replies)
Discussion started by: ramk
4 Replies

6. Shell Programming and Scripting

sed pattern matching

Unfortunately this chap has been banned for some reason and I was looking forward to the resolution of his question: - https://www.unix.com/shell-programming-scripting/123118-append-position-28-33-a.html He was asking if you can use sed to match a pattern you want to replace within a... (6 Replies)
Discussion started by: steadyonabix
6 Replies

7. Shell Programming and Scripting

sed pattern matching

Hi all, if I have the following piece (repeating) of text within a file and I wish to delete it via sed a b c d e <tr> <td><img alt="" height="1" width="3" src="/testweb/view/browser/images/shim.gif"></td><td><img alt="" height="1" ... (4 Replies)
Discussion started by: srage
4 Replies

8. Shell Programming and Scripting

Matching everything on a line using sed

I having a little trouble. I want to substitute whatever is on the first line no matter what is on it with the word BEGINNING. So on the first line, the only word on it is BEGINNING I tried the following: sed '1,1s/^ *.*$/BEGINNING/g' $FILE It works only if the 1st line starts with a... (2 Replies)
Discussion started by: quixoticking11
2 Replies

9. Shell Programming and Scripting

Matching '/' in SED

Hello, I have a list of filename is a file called list.dat. The filenames appear in the list.dat file as this: ./set.class ./one.class I want to delete these file names from the list file using sed. To test I was trying to match just the set.class. Eventually I want to delete all... (5 Replies)
Discussion started by: bestbuyernc
5 Replies

10. Shell Programming and Scripting

Pattern matching sed

MSG="THERE WERE XX RECORDS IN ERROR TABLE,AAAA, WHEN LOADING THE BBBB TABLE WITH EXTRACT FROM CCCC INTO TABLES FOR , DATABASE DDDD." echo "$MSG" > /tmp/mplanmsg.$$.out I wan to replace XX with the content in $recordXX cat /tmp/mplanmsg.$$.out|sed 's/XX/\$recordXX/g'| sed... (3 Replies)
Discussion started by: leemjesse
3 Replies
Login or Register to Ask a Question