Re-use AWK components
[khatus.git] / src / awk / exe / parse_metar_d_output.awk
similarity index 78%
rename from bin/khatus_parse_metar_d_output
rename to src/awk/exe/parse_metar_d_output.awk
index 1dd2778..fa354da 100755 (executable)
@@ -1,13 +1,6 @@
-#! /usr/bin/awk -f
-#
 # Qualifying the name as "_d_output" lest it be mistaken for parser of actual
 # metar format.
 
-BEGIN {
-    OFS = msg_fs ? msg_fs : "|"
-    Kfs = key_fs ? key_fs : ":"
-}
-
 /METAR pattern not found in NOAA data/ {
     failures++
     exit
@@ -15,15 +8,15 @@ BEGIN {
 
 /[A-z][a-z]+ *: / {
     split($0, line, ":")
-    key = strip(line[1])
-    val = strip(line[2])
+    key = util_strip(line[1])
+    val = util_strip(line[2])
     values[NR] = val
     first[key] = NR
     last[key] = NR
 }
 
 /^ +/ {
-    values[NR] = strip($0)
+    values[NR] = util_strip($0)
     last[key] = NR
 }
 
@@ -45,9 +38,3 @@ END {
         }
     }
 }
-
-function strip(s) {
-    sub("^ *", "", s)
-    sub(" *$", "", s)
-    return s
-}
This page took 0.023924 seconds and 4 git commands to generate.