#! /usr/local/bin/gawk -f
/insert into/ {
sub(/^ *insert into */,"")
sub(/ .*/,"")
print "insert into", $0, "(" }
/=>/ {
sub(/^ */,""); sub(/ *[,)] *$/,"")
split($0, fv, " *=> *")
f[++n] = fv[1]; v[n] = fv[2] }
END {
for (i=1; i<=n; i++)
(i == n) ? ")" : ","
print "values ("
for (i=1; i<=n; i++)
(i == n) ? ")" : "," }
IyEgL3Vzci9sb2NhbC9iaW4vZ2F3ayAtZgoKL2luc2VydCBpbnRvLyB7CiAgICBzdWIoL14gKmluc2VydCBpbnRvICovLCIiKQogICAgc3ViKC8gLiovLCIiKQogICAgcHJpbnQgImluc2VydCBpbnRvIiwgJDAsICIoIiB9CgovPT4vIHsKICAgIHN1YigvXiAqLywiIik7IHN1YigvICpbLCldICokLywiIikKICAgIHNwbGl0KCQwLCBmdiwgIiAqPT4gKiIpCiAgICBmWysrbl0gPSBmdlsxXTsgdltuXSA9IGZ2WzJdIH0KCkVORCB7CiAgICBmb3IgKGk9MTsgaTw9bjsgaSsrKQogICAgICAgIHByaW50ZiAiJXMlc1xuIiwgZltpXSwKICAgICAgICAgICAgKGkgPT0gbikgPyAiKSIgOiAiLCIKICAgIHByaW50ICJ2YWx1ZXMgKCIKICAgIGZvciAoaT0xOyBpPD1uOyBpKyspCiAgICAgICAgcHJpbnRmICIlcyVzXG4iLCB2W2ldLAogICAgICAgICAgICAoaSA9PSBuKSA/ICIpIiA6ICIsIiB9
aW5zZXJ0IGludG8gdGFibGVuYW1lICgKICAgIGZpZWxkXzEgPSZndDsgdmFsdWVfMSwKICAgIGZpZWxkXzIgPSZndDsgdmFsdWVfMiwKICAgIGZpZWxkXzMgPSZndDsgdmFsdWVfMyk=
insert into tablename (
field_1 => value_1,
field_2 => value_2,
field_3 => value_3)