|Welcome to the Monastery|
One-liner only checking the first line of the input fileby TJCooper (Beadle)
|on Nov 11, 2015 at 14:17 UTC||Need Help??|
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\t$F" if $F > 0' < input.txt
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?
For example, if my input file contains:
77 * 10 0 * * 0 340
141 * 40 0 * * 0 240
The output file will only contain: