diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-07-29 09:06:37 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-07-29 09:06:37 +0000 |
commit | 35d078802c5d35b319fb963060ca6c879af34dbe (patch) | |
tree | 69cbe4e2b5e02096b4ac6119d434f655352952eb /striplog | |
parent | d550e5dfd6393e9013985501c293dfb10e80bed5 (diff) | |
download | gpsd-35d078802c5d35b319fb963060ca6c879af34dbe.tar.gz |
Add regression test for R=2 mode.
Diffstat (limited to 'striplog')
-rwxr-xr-x | striplog | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/striplog b/striplog new file mode 100755 index 00000000..8bd46d6d --- /dev/null +++ b/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()) |