Computing.Net > Forums > Unix > How to add a ' character in awk

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to add a ' character in awk

Reply to Message Icon

Name: abhijits
Date: March 22, 2007 at 03:38:54 Pacific
OS: HPUX
CPU/Ram: 1GB
Product: HP
Comment:

Hi,

I want to add the single quote to the beginning and end of all the strings contained in a file.
i.e. my file is like
abc
dfg
hjk
and i want an output like
'abc'
'dfg'
hjk'

Using sed / awk i am not able to put the ' character .. i am somehow not able to escape this character



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: March 22, 2007 at 09:52:03 Pacific
Reply:

sed "s&^&'&g" myfile | sed "s&$&'&g"


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: How to add a ' character in awk

how to list a directory in realtime www.computing.net/answers/unix/how-to-list-a-directory-in-realtime/8218.html

how to add a static route www.computing.net/answers/unix/how-to-add-a-static-route/2017.html

how to replace a file in a .zip fil www.computing.net/answers/unix/how-to-replace-a-file-in-a-zip-fil/7497.html