Hi, <div><br></div><div>I have the following code in a loop:</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span> <span class="Apple-style-span" style="white-space: pre;">open(OUTFILE, "$cmd >> myfile"); # append write</span> </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> print OUTFILE content();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> close(OUTFILE);</div></div><div><div><span class="Apple-tab-span" style="white-space:pre"><br>
</span></div><div><span class="Apple-tab-span" style="white-space:pre">T</span>he $cmd is a complicated sed command. For simplicity purpose, let's say it is </div><div><br></div><div> | sed -n '10,20p' </div>
<div><br></div><div>I.e., printing only lines 10~20 of the content of each loop. </div><div><br></div><div>My goal is to write to STDOUT instead of a fixed file. I tried to change the above open statement with</div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> open(OUTFILE, "$cmd >-"); # write to STDOUT</div></div><div><br></div><div>or,</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span> open(OUTFILE, "$cmd >>-"); # write to STDOUT</div>
</div><div><br></div><div>but didn't get any output. </div><div><br></div><div>Anyone can help me here? </div><div><br></div><div>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.</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Thanks</div><div><br></div><div>antonio</div><div><br></div><div><br></div>