Diffstat (limited to 'libopie2/tools/stripmanuf.py') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | libopie2/tools/stripmanuf.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libopie2/tools/stripmanuf.py b/libopie2/tools/stripmanuf.py new file mode 100755 index 0000000..28de0f9 --- a/dev/null +++ b/libopie2/tools/stripmanuf.py | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | # | ||
4 | # converts a manufacturer file in ethereal format (taken from their CVS) | ||
5 | # into something smaller and faster parseable | ||
6 | # | ||
7 | |||
8 | import sys | ||
9 | import os | ||
10 | |||
11 | i = file( sys.argv[1], "r" ) | ||
12 | o = file( sys.argv[2], "w" ) | ||
13 | |||
14 | for line in i: | ||
15 | #print line.strip() | ||
16 | entries = line.strip().split() | ||
17 | #print "number of entries =", len( entries ) | ||
18 | #print entries | ||
19 | if len( entries ) < 2: | ||
20 | continue | ||
21 | elif len( entries ) == 2: | ||
22 | print "2-line detected." | ||
23 | print >>o, entries[0], entries[1], entries[1] | ||
24 | elif len( entries ) > 2: | ||
25 | print >>o, entries[0], entries[1], "_".join( entries[3:] ) | ||
26 | else: | ||
27 | assert( false ) \ No newline at end of file | ||