diff options
author | Thomas White <taw@physics.org> | 2017-12-07 16:42:42 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-12-07 16:42:42 +0100 |
commit | 1161fc80e9d23d83e325d7372f92a410b2498837 (patch) | |
tree | 3fced4da4e4b54acf64407902d5299e6187549c8 /scripts | |
parent | 487e744949bab2ecb48ff3770539f77eba12e903 (diff) |
scripts/truncate_stream: Accept input on stdin
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/truncate-stream | 6 |
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 |