vendredi 26 mai 2017

Filter text file based on column value

I have a text file with 26 columns and have to filter rows if column 22 has the value of '1', '2' or '3' (out of 6). I have two filter criteria to follow

If Column 22 has value '1', '2' or '3', then remove anything less than 10 and greater 100 (based on column 5) AND remove anything less than 5.0 (this column has decimals) (based on column 13).

I am not sure how to insert the condition of do the following only if column 22 has the following values of 1 to 3 and retain the other rows as it is in the output

awk -F "\t"  'NR==1; NR>1 {if ($5 > 10 && $5<100 && $13>5.0) print $0}' input.txt > output.txt

Any help is appreciated. Thank you

Aucun commentaire:

Enregistrer un commentaire