awk version: GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.2-p3, GNU MP 6.0.0)

I have the following input (small example):

Lh8627_00055___transposase_3    c368296268f9d0100b8a65d2cd57aaf2    424 Pfam    PF01610 Transposase 297 404 1.8E-11 T   22-06-2017  IPR002560   Transposase IS204/IS1001/IS1096/IS1165, DDE domain      
Lh8627_05835___transposase_1    212014f87f94178312dac70f061d81c6    469 Pfam    PF06782 Uncharacterised protein family (UPF0236)    30  399 4.5E-37 T   22-06-2017  IPR009620   Uncharacterised protein family UPF0236      
Lh8627_03700___transposase_3    916962acc8271c66b217ab903d836768    401 Pfam    PF06782 Uncharacterised protein family (UPF0236)    201 334 4.4E-6  T   22-06-2017  IPR009620   Uncharacterised protein family UPF0236      
Lh8627_01850___transposase_1    05e46b0f13cf6aa7db8adcf5fd3fd39d    409 Pfam    PF01548 Transposase 8   160 3.0E-29 T   22-06-2017  IPR002525   Transposase, IS111A/IS1328/IS1533, N-terminal   GO:0003677|GO:0004803|GO:0006313    

I would like to filter lines which have in the 9th column a value lower than 1.0E-10

My command is awk '$9 < 1.0E-10' my file. But it is not filtering the 3rd line in the small input above for example. What am I doing wrong?

closed as off-topic by Michael Homer, Jeff Schaller, user34720, Rui F Ribeiro, Stephen Rauch Jun 23 '17 at 13:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Michael Homer, Jeff Schaller, Community, Rui F Ribeiro, Stephen Rauch
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    with your input - they all should be filtered out. Otherwise, it's unclear whether it should consider only numbers and remove the lines with non-number (in 9th field) by default – RomanPerekhrest Jun 23 '17 at 8:01
  • 1
    you wrote the 9th column - with awk default separator the 9th field values are ` 1.8E-11 T (UPF0236) ...` – RomanPerekhrest Jun 23 '17 at 8:05
  • 1
    4.5E-37 is not in 9th field – RomanPerekhrest Jun 23 '17 at 8:06
  • 1
    In the third line, the ninth field is “(UPF0236)”. – Stephen Kitt Jun 23 '17 at 8:06
  • 1
    you are confusing your input with your description – RomanPerekhrest Jun 23 '17 at 8:07

My problem was that I did not understand that awk also uses space as delimiter and not only tab. After adding -F'\t' it works. The number comparison was fine.


Your command is good. However, your input is not: the 9th member in your example is not always the expected number:

$ awk '{print $9}' <your_file>

You could for example rearrange your input by removing unwanted elements using sed:

sed 's/protein family (UPF0236)//' <your_file> | awk '$9 < 1.0E-10'

Not the answer you're looking for? Browse other questions tagged or ask your own question.