Hi
I have input vi file as below
a000000
b000000
c000000
d000000
Need output as below
'a000000','b000000','c000000','d000000'
Please let us know how to do it
Hi
I have input vi file as below
a000000
b000000
c000000
d000000
Need output as below
'a000000','b000000','c000000','d000000'
Please let us know how to do it
try:
awk '$1=$1 {print "\x27" $0 "\x27"}' RS= OFS="','" file
RS=
(no record separator)
OFS="','"
(output field separator)
$1=$1
(merge fields with defined OFS)
\x27
(hex tick mark)
I'm seeing below error message.
bash-3.00$ awk '$1=$1 {print "\x27" $0 "\x27"}' RS= OFS="','" testy1
awk: syntax error near line 1
awk: bailing out near line 1
testy1 is the vi file it has following lines
p422989
p443149
p445676
p452377
p454398
p455775
p457716
p458345
p459716
p465880
p466427
p466428
p467681
Try:
awk '{s=s (s?OFS:x) q $0 q} END{print s}' q=\' OFS=, file
----
On Solaris use /usr/xpg4/bin/awk rather than awk