Hello
I have a tab text file with many columns and have to filter rows ONLY if column 22 has the value of '0', '1', '2' or '3' (out of 0-5).
If Column 22 has value '0','1', '2' or '3' (highlighted below), 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 tried the following codes but I am not sure how to insert the condition of do the following only if column 22 has the following values of 0 to 3 and retain the other rows (ie that has values 4 and 5) as it is in the output file
awk -F "\t" 'NR==1; NR>1 {if ($5 > 10 && $5<100 && $13>5.0) print $0}' input.txt > output.txt
awk -F'\t' 'NR==1 || 0<=$22 && $22<=3 && 10<$5 && $5<100 && 5<$13' input > output
My input file is as follows
and
Column1 ... Column5 ... Column13 .. Column22
ID1 a1 5 0 5
ID2 a2 10 1.2 0
ID3 a3 4 5.6 1
ID4 a4 300 2.6 2
ID5 a5 40 32 0
ID6 a6 200 4.6 3
ID7 a7 200 4.5 5
ID8 a8 3456 4.9 4
and my desired output is
Column1 .. Column5 .. Column13 .. Column22
ID1 a1 5 0 5
ID5 a5 40 32 0
ID7 a7 200 4.5 5
ID8 a8 3456 4.9 4
Any help is appreciated. Thank you