# # Lines.awk - used to analysye Wireshark ISUP decode and prepend lines with a sortable string. # # usage mawk -f lines.awk op.txt # usage mawk -f lines.awk op.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. # # # messgaes 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 /^ISDN User Part/{ ISUPflag=1 ln=10000 cm = "" want = 0 } # find my LUA ISUP disector and ignore for now. /ISUP lua Dissector data/{ ln=10000 cm = "zlua_" want = 0 } # find start of Message / Message type:/{ if ( ISUPflag ){ ln=10000 cm = "msg_" $NF ":" want = 1 } } /Optional Parameter:/{ ln=10000 cm = "opp_" $3 ":" want = 1 } #PCI is an unordered list /Upgraded parameter no:/{ ln=20000 cm = "upn_" ":" want = 1 } /^Frame /{ ln=10000 cm="" want = 0 ISUPflag=0 } /End of optional parameters|Pointer to start of optional part|No optional parameter present (Pointer: 0)/{ ln=10000 cm="" want = 0 } # # While ( WANT ) print of line with a prefix with a line number. # ( want ) { print cm ln " :" $0 ln = ln + 1 }