If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > cant replace values by unix env variables in sed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-09, 21:06
ymho ymho is offline
Registered User
 
Join Date: Jul 2006
Posts: 109
cant replace values by unix env variables in sed

pls advise

A=1
B=2
C=3
echo ABC | sed '
s/A/$A/
s/B/$B/
s/C/$C/
'
==> result
$A$B$C
==> expected result
123
Reply With Quote
  #2 (permalink)  
Old 01-16-09, 03:57
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Replace the single quotes with double quotes. The shell doesn't do variable substitution within single quotes.
Reply With Quote
  #3 (permalink)  
Old 01-19-09, 04:36
ymho ymho is offline
Registered User
 
Join Date: Jul 2006
Posts: 109
Talking

thanks a lot
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On