diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-09-04 19:11:51 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-09-04 19:11:51 +0000 |
commit | d7f2e6b347ad03dd4a113360660b09b8c8f364db (patch) | |
tree | 488477611024f2fb32227c5e0bfd45b23bac10a4 /devtools/striplog | |
parent | 69db57a927b236c26dd55345c8dfa34b9bb48584 (diff) | |
download | gpsd-d7f2e6b347ad03dd4a113360660b09b8c8f364db.tar.gz |
Reorganize, moving a rarely-used/semi-obsolescent stuff into subdirectories.
Diffstat (limited to 'devtools/striplog')
-rwxr-xr-x | devtools/striplog | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/devtools/striplog b/devtools/striplog new file mode 100755 index 00000000..8bd46d6d --- /dev/null +++ b/devtools/striplog @@ -0,0 +1,25 @@ +#!/usr/bin/python +# +# striplog -- strip leading lines from logs +# +# striplog -1 strips the first line only. +# striplog with no option strips all leading lines beginning with # +# +import getopt, sys + +firstline = False +(options, argumwnts) = getopt.getopt(sys.argv[1:], "1") +for (switch, val) in options: + if (switch == '-1'): + firstline = True + +if firstline: + sys.stdin.readline() +else: + while True: + line = sys.stdin.readline() + if line[0] != '#': + break + sys.stdout.write(line) + +sys.stdout.write(sys.stdin.read()) |