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, &quot;$cmd &gt;&gt; myfile&quot;);   # 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&#39;s say it is </div><div><br></div><div>  | sed -n &#39;10,20p&#39; </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, &quot;$cmd &gt;-&quot;);   # 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, &quot;$cmd &gt;&gt;-&quot;);   # write to STDOUT</div>
</div><div><br></div><div>but didn&#39;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&#39;t do it this way and open outside the loop instead, I&#39;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>