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
Double quotes or single quotes when using ssh? password636 Shell Programming and Scripting 3 05-29-2008 05:52 PM
awk to print ' (single quotes) orahi001 UNIX for Dummies Questions & Answers 2 03-11-2008 01:30 PM
problem with single quotes in a string and findbug bob122480 Shell Programming and Scripting 9 01-19-2007 08:38 AM
im stuck! 'single quotes' satnamx UNIX for Dummies Questions & Answers 4 03-29-2006 03:44 AM
Filename containing Single Quotes phani Shell Programming and Scripting 6 03-30-2005 03:47 AM

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

Join Date: Apr 2008
Posts: 5
Add single quotes in string

Hi All, I love this site, it helps newbie people like me and I appreciate everyone's help!
Here is my questions.

I am trying to concatenate a single quote into a character/string from a text file for each line (lets say ABC should look like 'ABC').
I tried to use awk print command to do this, but it always gives me syntax error (i followed the awk document as it says).
Is there a unix short cut command to do this ?
thanks a lot!
Reply With Quote
Forum Sponsor
  #2  
Old 07-18-2008
joeyg's Avatar
Moderator
 

Join Date: Dec 2007
Location: Home of world champion Boston Celtics
Posts: 983
Wink what about how I build val2 or val3

Code:
> val1="ABC"        
> echo $val1
ABC
> val2="'$val1'"
> echo $val2
'ABC'
> val3="'""$val1""'"
> echo $val3
'ABC'
While what I do for val3 looks like a little over-kill, it can sometimes be easier to later debug as you just follow the pairs of quotes " " to determine what should happen.
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 08:52 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 Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0