awk: print first line in which a field condition is met
awk, conditional-statements, line, printing
Solution
The first thing that springs to mind is to add `exit`:
awk '$3 >= 0.2 { print $3, $5; exit }' file
But unless that's all you want to do, you will need a flag:
awk '$3 >= 0.2 && !f { print $3, $5; f=1 }' file
Problem
I know it's a ridiculously simple problem, but I'd like to print the first line in many files for which a given field condition is met: ``` $ awk ' ( $3>=0.2 ) { print $3, $5 } ' Data.out ``` I've tried to insert END in a few places to exit printing, but I can't get it to work... The above prints ALL the lines for which $3>=0.2...