summaryrefslogtreecommitdiff
path: root/striplog
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-07-29 09:06:37 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-07-29 09:06:37 +0000
commit35d078802c5d35b319fb963060ca6c879af34dbe (patch)
tree69cbe4e2b5e02096b4ac6119d434f655352952eb /striplog
parentd550e5dfd6393e9013985501c293dfb10e80bed5 (diff)
downloadgpsd-35d078802c5d35b319fb963060ca6c879af34dbe.tar.gz
Add regression test for R=2 mode.
Diffstat (limited to 'striplog')
-rwxr-xr-xstriplog25
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())