You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
547 B
Awk

4 years ago
BEGIN {
avln = 0
nl = 0
printf( "{\"devices\":[" )
}
/^ P\/L / {
avln++
}
/^ (LOC|REM) / {
if (nl == 1)
printf( "," )
printf( "{" )
printf( "\"avln_num\":\"%s\"\n", avln )
printf( ",\"local\":\"%s\"", $1 == "LOC" )
printf( ",\"cco\":\"%s\"\n", $2 == "CCO" )
printf( ",\"tei\":\"%s\"\n", $3+0 )
printf( ",\"mac\":\"%s\"\n", $4 )
printf( ",\"bda\":\"%s\"\n", $5 )
if ($1 != "LOC") {
printf( ",\"tx\":\"%.0f\"\n", ($6+0)*21/16 )
printf( ",\"rx\":\"%.0f\"\n", ($7+0)*21/16 )
}
printf( "}" )
nl = 1
}
END {
printf( "]}\n" )
}