aboutsummaryrefslogtreecommitdiff
path: root/scripts/truncate-stream
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-12-07 16:42:42 +0100
committerThomas White <taw@physics.org>2017-12-07 16:42:42 +0100
commit1161fc80e9d23d83e325d7372f92a410b2498837 (patch)
tree3fced4da4e4b54acf64407902d5299e6187549c8 /scripts/truncate-stream
parent487e744949bab2ecb48ff3770539f77eba12e903 (diff)
scripts/truncate_stream: Accept input on stdin
Diffstat (limited to 'scripts/truncate-stream')
-rwxr-xr-xscripts/truncate-stream6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/truncate-stream b/scripts/truncate-stream
index 60679d30..7de5c953 100755
--- a/scripts/truncate-stream
+++ b/scripts/truncate-stream
@@ -114,7 +114,11 @@ if not (opt.ifn and opt.ofn):
print("You need at least --input and --output")
exit(1)
-f = open(opt.ifn, 'r')
+if opt.ifn == "-":
+ f = sys.stdin
+else:
+ f = open(opt.ifn, 'r')
+
g = open(opt.ofn, 'w')
start_after = opt.start
stop_after = opt.stop