awk script

Hi experts,
I have file which looks like :

chr1    2984741    2985289    chr1    2984289    2985289    -1000
chr1    54519111    54519244    chr1    54519111    54520111    -133
chr1    90098453    90098643    chr1    90098453    90099453    -190
chr1    95392779    95393583    chr1    95392779    95393779    -804
chr1    183441117    183441505    chr1    183441117    183442117    -388
chr1    762902    763177    chr1    762902    763902    -275
chr1    24741587    24742244    chr1    24741587    24742587    -657
chr1    33815499    33815952    chr1    33815499    33816499    -453

I have been trying to segregate the column 9 according minimum and maximum values. Minimum is from 0 to 500 and maximum from 500 to 1000. I wrote an awk script

 awk -v min=0 -v max=500 '   $9 == 0 { next }  min <= $10 && $10 <= max { print }'

.
But it does not work.
Can someone help.
Regards.

No surprise "it does not work" (whatever that might be). ALL lines have 7 fields only (unless this is an artefact introduced by copy/pasting), so nothing CAN be printed. On top, you are "trying to segregate the column 9 according minimum and maximum values" but you are evaluating field 10 (which doesn't exist). Field 9 is only checked to equal zero...

1 Like