X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fawk%2Fexe%2Fparse_metar_d_output.awk;fp=bin%2Fkhatus_parse_metar_d_output;h=fa354da4f0d2cf7025b0c8639294ce70d3984288;hb=03c229bffd594c1facb72e0d042a88c0505c8dbc;hp=1dd277895c32e85e8504a5b253d171b223cf6d4c;hpb=2e820ad561199f2ccc1ee3fa7e7e708e5dc8bc39;p=khatus.git diff --git a/bin/khatus_parse_metar_d_output b/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 --- a/bin/khatus_parse_metar_d_output +++ b/src/awk/exe/parse_metar_d_output.awk @@ -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 -}