perlquestion
TJCooper
<p>I have an 8-column input tab-delimited .txt file and wish to print the contents of column 3 + 8 when the value held within column 8 is >0. </p>
<p>I've tried:</p>
<code>perl -lane 'print "$F[2]\t$F[7]" if $F[7] > 0' < input.txt</code>
<p>However this only returns a single line (the first line) when there are multiple matching lines. I want it to iterate over every line instead. What have I done wrong?</p>
<p>For example, if my input file contains:</p>
<p><code>77 * 10 0 * * 0 340</code></p>
<p><code>141 * 40 0 * * 0 240</code></p>
<p>The output file will only contain:</p>
<p><code>10 340</code></p>