jeudi 21 mars 2019

Using awk if to filter fields with variable filter criteria

I am trying to filter several columns with the following code that works somewhat, except it gives values that are slightly over the threshold set by the condition. For example, if the condition is <=0.01, it gives all values that are <0.01 and also 0.011, 0.012 etc.

a) I don't understand why b) How do I fix it?

Thanks!

for n in $(seq 0.01 0.01 0.1) $(seq 0.1 0.1 1) 
do 
  awk 'BEGIN{FS=OFS="\t"}{if ($1<="'${n}'" && $1<="'${n}'" && $3<="'${n}'" && $4<="'${n}'" && $5<="'${n}'") print$0 ;}' file1
done

Aucun commentaire:

Enregistrer un commentaire