问题
I'd like to print every line in my file that satisfies the following:
print line if column 3 or column 4 or column 5 is less than 10
Example
Emma A 10 4 7
Sally A 4 4 7
Jack B 15 19 2
Jeff C 15 20 25
Mary A 15 20 25
Meg C 2 7 9
Output
Emma A 10 4 7
Sally A 4 4 7
Jack B 15 19 2
Meg C 2 7 9
回答1:
It's pretty simple with awk
:
awk '$3<10 || $4<10 || $5<10' file
The output:
Emma A 10 4 7
Sally A 4 4 7
Jack B 15 19 2
Meg C 2 7 9
来源:https://stackoverflow.com/questions/47927892/how-to-print-lines-based-on-values-in-multiple-columns