Hello Radoulov,
Thanks for your reply and sorry for my lack of knowledge in awk.
I am using solaris 10 - I have tried as follows:
I have created a script : chk.awk
Quote:
#! /usr/xpg4/bin/awk
awk 'END {
printf fmt, ++c, tab, cols, values
}
NR == 1 {
tab = $1
fmt = "REC %d: INSERT INTO %s(%s)\nVALUES\n(%s);\n"
next
}
/^REC/ && cols {
printf fmt, ++c, tab, cols, values
cols = ""
values = ""
next
}
{
$2 = $2 ~ /^[0-9]/ ? $2 : q $2 q
cols = cols ? cols "," $1 : $1
values = values ? values "," $2 : $2
}' FS=" *: *" q="'"
|
input text is stored in a file : qqq
While I am calling the script - I am getting the following error:
Quote:
{mukher2}/export/home/mukher2:awk -f chk.awk qqq
awk: syntax error near line 2
awk: bailing out near line 2
{mukher2}/export/home/mukher2:
|
Please can you advise ?