Le 02/02/2011 17:33, gene golub a écrit :
Hello folks,

Can you please help me: I have file with lines:
aaa
bbb
ccc

I need to produce:
'aaa'
'bbb'
'ccc'

first of all, this is not the forum to talk about general purpose shell usage. next time, try a more appropriate one like news:comp.unix.shell

however, the trick here is to use an awk variable to avoid unnecessary quoting things such as :

awk -v q="'" '{ print q $0 q }' << 'EOF'
aaa
bbb
ccc
EOF

which is far more readable than :

awk '{ print "'"'"'" $0 "'"'"'" }' << 'EOF'
aaa
bbb
ccc
EOF

or

awk "{ print \"'\" \$0 \"'\" }" << 'EOF'
aaa
bbb
ccc
EOF

Regards,

Cyrille Lefevre
--
mailto:[email protected]



_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to