TJCooper has asked for the wisdom of the Perl Monks concerning the following question:
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.
I've tried:
perl -lane 'print "$F[2]\t$F[7]" if $F[7] > 0' < input.txtHowever 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?
For example, if my input file contains:
77 * 10 0 * * 0 340
141 * 40 0 * * 0 240
The output file will only contain:
10 340
Back to
Seekers of Perl Wisdom