The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
doubt in awk jisha Shell Programming and Scripting 4 04-16-2008 01:02 AM
AWK doubt Rafael.Buria Shell Programming and Scripting 2 02-06-2008 07:00 AM
doubt about awk soujanya_srk UNIX for Dummies Questions & Answers 2 01-10-2008 01:26 PM
awk doubt.. esham Shell Programming and Scripting 11 10-10-2007 11:24 PM
ftp doubt ranj@chn Shell Programming and Scripting 0 01-04-2006 04:47 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-03-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,576
doubt in sed

hi all,

i have a variable exported as

VAR=ATTRIB

then tried with,
echo "tt" | sed 's/^/$VAR/'

expected result as
ttATTRIB

but obtained only,
$VARtt

i could nt get where i am wrong.

Thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-03-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
echo "tt" | sed "s/$/$VAR/"
Reply With Quote
  #3 (permalink)  
Old 08-03-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,576
Thanks,

I had already tried the very same thing that u had provided

echo "tt" | sed 's/$/$VAR/'

ended in vain.

But,
echo "tt" | sed "s/$/$VAR/"

came up with an answer.

Could you please help me with difference between ' and " in sed
Reply With Quote
  #4 (permalink)  
Old 08-03-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
This has got nothing to do with 'sed', but rather with the surrounding shell expanding [double-quotes] / or not expanding [single-quotes] the "quoted" variable.

Do 'man ksh' and search for 'Quoting'
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:31 PM.


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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0