antispam

commit 8560e3c0dc8f96da95305b41c45d25706b52b763

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

json: add a awk script to convert raw data to json

awk is so cool

 to_json.awk | 15 +++++++++++++++


diff --git a/to_json.awk b/to_json.awk
new file mode 100644
index 0000000000000000000000000000000000000000..bd59824e5d3b1fd2b3628a80ea771e6d667976c2
--- /dev/null
+++ b/to_json.awk
@@ -0,0 +1,15 @@
+BEGIN {
+	print "["
+}
+
+NR > 1 {
+	print "\t \"" line "\"" ", "
+} {
+	line=$0;
+}
+
+# The last item on a json array can't have a comma, that's why we print it here
+END {
+	print "\t \"" $0 "\""
+	print "]"
+}