summaryrefslogtreecommitdiff
path: root/devtools/striplog
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-04 19:11:51 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-04 19:11:51 +0000
commitd7f2e6b347ad03dd4a113360660b09b8c8f364db (patch)
tree488477611024f2fb32227c5e0bfd45b23bac10a4 /devtools/striplog
parent69db57a927b236c26dd55345c8dfa34b9bb48584 (diff)
downloadgpsd-d7f2e6b347ad03dd4a113360660b09b8c8f364db.tar.gz
Reorganize, moving a rarely-used/semi-obsolescent stuff into subdirectories.
Diffstat (limited to 'devtools/striplog')
-rwxr-xr-xdevtools/striplog25
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())