[tpm] Writing to STDOUT in batches
antoniosun at lavabit.com
Mon Dec 6 07:22:57 PST 2010
I have the following code in a loop:
open(OUTFILE, "$cmd >> myfile"); # append write
print OUTFILE content();
The $cmd is a complicated sed command. For simplicity purpose, let's say it
| sed -n '10,20p'
I.e., printing only lines 10~20 of the content of each loop.
My goal is to write to STDOUT instead of a fixed file. I tried to change the
above open statement with
open(OUTFILE, "$cmd >-"); # write to STDOUT
open(OUTFILE, "$cmd >>-"); # write to STDOUT
but didn't get any output.
Anyone can help me here?
BTW, in case you wonder why the open statement is in the loop -- if I don't
do it this way and open outside the loop instead, I'll get the
first 10~20 lines only from the first loop.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the toronto-pm