X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=bin%2Fkhatus_parse_metar_d_output;h=1dd277895c32e85e8504a5b253d171b223cf6d4c;hb=ab9fe663178272812f83e496c428813e3611368f;hp=b2283904da5388a7e2de7471104143a75490b0fd;hpb=3fc7fe2c8c717bee50010994176fd1e99f12d703;p=khatus.git diff --git a/bin/khatus_parse_metar_d_output b/bin/khatus_parse_metar_d_output index b228390..1dd2778 100755 --- a/bin/khatus_parse_metar_d_output +++ b/bin/khatus_parse_metar_d_output @@ -3,10 +3,9 @@ # Qualifying the name as "_d_output" lest it be mistaken for parser of actual # metar format. -function strip(s) { - sub("^ *", "", s) - sub(" *$", "", s) - return s +BEGIN { + OFS = msg_fs ? msg_fs : "|" + Kfs = key_fs ? key_fs : ":" } /METAR pattern not found in NOAA data/ { @@ -36,12 +35,19 @@ END { split(temp_string, temp_parts, " +") temp_celsius = temp_parts[1] temp_fahrenheit = (temp_celsius * (9 / 5)) + 32 - print "temperature " temp_fahrenheit "°F" + print("temperature_c", temp_celsius) # °C + print("temperature_f", temp_fahrenheit) # °F for (i=first["Phenomena"]; i<=last["Phenomena"]; i++) { phenomenon = values[i] if (phenomenon) { - print "phenomenon " phenomenon + print("phenomenon" Kfs i, phenomenon) } } } } + +function strip(s) { + sub("^ *", "", s) + sub(" *$", "", s) + return s +}