summaryrefslogtreecommitdiff
path: root/libopie2/tools/stripmanuf.py
blob: 28de0f94ee8599c49bebe7e61a3a93744c0eb6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

#
# converts a manufacturer file in ethereal format (taken from their CVS)
# into something smaller and faster parseable
#

import sys
import os

i = file( sys.argv[1], "r" )
o = file( sys.argv[2], "w" )

for line in i:
    #print line.strip()
    entries = line.strip().split()
    #print "number of entries =", len( entries )
    #print entries
    if len( entries ) < 2:
        continue
    elif len( entries ) == 2:
        print "2-line detected."
        print >>o, entries[0], entries[1], entries[1]
    elif len( entries ) > 2:
        print >>o, entries[0], entries[1], "_".join( entries[3:] )
    else:
        assert( false )