Skip to content

Instantly share code, notes, and snippets.

@minkymorgan
Forked from drjerry/tab2json.awk
Last active Aug 29, 2015
Embed
What would you like to do?
NR == 1 {sep=""}
NR > 2 {sep=","}
{
if (NR == 1) {
split($0, tags);
if (EC == "") EC = "\"";
}
else {
split($0, vals);
jrec = sep"{";
for (i = 1; i <= NF; ++i) {
if (vals[i] ~ /[^0-9.]/)
jrec = jrec EC tags[i] EC ":" EC vals[i] EC;
else
jrec = jrec EC tags[i] EC ":" vals[i];
if (i < NF)
jrec = jrec ", ";
else
jrec = jrec "}";
}
print jrec;
}
}
@drjerry
Copy link

drjerry commented Oct 21, 2014

Nice fix from the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment