[tpm] Writing to STDOUT in batches
antoniosun at lavabit.com
Mon Dec 6 08:36:37 PST 2010
On Mon, Dec 6, 2010 at 10:22 AM, Antonio Sun <antoniosun at lavabit.com> wrote:
> 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 is
> | 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.
Thank you Richard to have solved my problem. -- I was too carried away with
redirections. As you've pointed out, this alone work just as expected:
open(OUTFILE, "$cmd"); # write to STDOUT
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the toronto-pm