The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-21-2008
Registered User
 

Join Date: May 2008
Location: St. Louis
Posts: 74
sed help

Hi ,
i am trying to make a change to my file . The code is

sed -e 's/\(ts_rep[^ ]*\)/\1_S02/g' tempfile_tbsp_TS_REPL.ddl

The output comes like this

create tablespace TS_REPL_S02 in ALL_PARTITIONS pagesize 16384 MANAGED BY DATABASE
USING (file '/dmpath/dmdiadm2/db2fs1p01/ts_repl'_S02 100 ) on dbpartitionnum 1
USING (file '/dmpath/dmdiadm2/db2fs1p02/ts_repl'_S02 100 ) on dbpartitionnum 2

But I want the output like this

create tablespace TS_REPL_S02 in ALL_PARTITIONS pagesize 16384 MANAGED BY DATABASE
USING (file '/dmpath/dmdiadm2/db2fs1p01/ts_repl_S02' 100 ) on dbpartitionnum 1
USING (file '/dmpath/dmdiadm2/db2fs1p02/ts_repl_S02' 100 ) on dbpartitionnum 2

I mean I want that single quote outside the string !

Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 05-21-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Code:
sed -e 's/\(ts_rep[^ ']*\)/\1_S02/g' tempfile_tbsp_TS_REPL.ddl
Notice the addition of a single quote to the negated character class. I even colored it red but it's still not really obvious ...
Reply With Quote
  #3  
Old 05-21-2008
Registered User
 

Join Date: May 2008
Location: St. Louis
Posts: 74
Era,
Its still not working .

apsp8640:/tmp #sed 's/\(ts_rep[^ ']*\)/\1_S02/g' tempfile_tbsp_TS_REPL.ddl
>


Thanks,
Reply With Quote
  #4  
Old 05-21-2008
Registered User
 

Join Date: May 2008
Location: St. Louis
Posts: 74
even with -e

apsp8640:/tmp #sed -e 's/\(ts_rep[^ ']*\)/\1_S02/g' tempfile_tbsp_TS_REPL.ddl
>


It is expecting something else too ....

Thanks
Reply With Quote
  #5  
Old 05-21-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Ahh, of course not, sorry.

Code:
sed -e 's/\(ts_rep[^ '"'"']*\)/\1_S02/g' tempfile_tbsp_TS_REPL.ddl
You can't have a bare single quote in a single-quoted string, obviously. The one thing I decided I don't have to test jumped up and bit me in the behind ...
Reply With Quote
  #6  
Old 05-21-2008
Registered User
 

Join Date: May 2008
Location: St. Louis
Posts: 74
You rock dude !!!

Cheers

Daya
Reply With Quote
  #7  
Old 05-21-2008
Registered User
 

Join Date: May 2008
Location: St. Louis
Posts: 74
You rock dude !!!

Cheers

Daya
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0