# # Lines.awk - used to analysye K1205 rec2Ascii ISUP decode and prepend lines with a sortable string. # # usage mawk -f lines2.awk *.RF5.TXT # usage mawk -f lines.awk *.RF5.TXT | sort | mawk -f unique.awk # # Description: try to analyse ISUP and collate messages to find a profile of usage. # The BIG problem is that the optional parameters are in any order. # It could be thought of as a Tree with leaves of variable size. # The branches are variable as well. # # # messages have mandatory, variable mandatory, optional parameters. # # parameters are multi-line. # # The objective is to try to totalize unique usages of lines of a parameter. # # find blocks of text, reset line number and prened with block name and line number # # BEGIN { cm = "" } # # define some rules tofind start of blocks of text. Set / reset want # # find ISUP ## find parameter name which has four spaces preceeding. /^ /{ msg = $0 } ##============================================================ # # Turn on want events # ## /Message Type/{ ln=10000 cm = "msg_" msg " :" want = 1 } ##Parameter Length /Parameter Length/{ ln=10000 cm = "opp_" msg ":" want = 1 } #PCI is an unordered list /upgraded parameter/{ ln=20000 cm = "upn_" ":" want = 1 } ##============================================================ # # While ( WANT ) print of line with a prefix with a line number. # ( want ) { print cm ln " :" $0 ln = ln + 1 } ##============================================================ # # Turn off want events # /^$/{ # print "BlankLine " NR print cm ln " :" $0 ln=10000 cm="" want = 0 } /^=================================/{ print cm ln " :" $0 ln=10000 cm="" want = 0 } ## Pointer to parameter /Pointer to parameter/{ print cm ln " :" $0 ln=10000 cm="" want = 0 } / Message Signal Unit /{ print cm ln " :" $0 ln=10000 cm="" want = 0 } # # We want to turn off want now # /End of optional parameters/{ print cm ln " :" $0 ln=10000 cm="" want = 0 }