File: get_uniq.py

package info (click to toggle)
gr-air-modes 0.0.2.c29eb60-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,348 kB
  • ctags: 2,759
  • sloc: python: 12,444; cpp: 457; xml: 263; makefile: 46; ansic: 35; sh: 1
file content (21 lines) | stat: -rwxr-xr-x 521 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

import sys, re

if __name__== '__main__':
    data = sys.stdin.readlines()
    icaos = []
    num_icaos = 0
    for line in data:
        match = re.match(".*from (\w+)", line)
        if match is not None:
            icao = int(match.group(1), 16)
            icaos.append(icao)

    #get dupes
    dupes = sorted([icao for icao in set(icaos) if icaos.count(icao) > 1])
    for icao in dupes:        
        print "%x" % icao
    print "Found non-unique replies from %i aircraft" % len(dupes)