Ubuntu – How to remove lines with a number less than 60 in column 3

command linetext processing

I have a large file. I need to remove all lines in a file which have a number less than 60 in column 3.

Example file:

35110   Bacteria(100)   Proteobacteria(59)  Alphaproteobacteria(59)
12713   Bacteria(100)   Bacteroidetes(100)  Bacteroidia(100)

Desired output:

12713   Bacteria(100)   Bacteroidetes(100)  Bacteroidia(100)

Best Answer

No need for Gawk extensions:

awk -F '[()]' '$4 >= 60'

Here the awk field tokenizer specified via -F is a regex set []: fields get separated by either an opening or closing parenthesis, hence you see the number of your 3rd column is the 4th awk field.