I am trying to execute the following awk command
awk '{ if($3-$2 >= 1000) print $1"\t"$3-1000"\t"$3"\t"$4"\t"$5 ; else if($3-$2 < 1000) print $1"\t"$3-($3-$2/2)"\t"$3"\t"$4"\t"$5 }'file
where if the subtraction between column 3 and 2 is > 1000 then follow a certain condition , else follow another condition in which column 2 is column3-(column3-column2/2) in whole number. The file looks as follows:
chrX 99885864 99887481 I7 -
chrX 99887566 99888401 I6 -
chrX 99888537 99888927 I5 -
chrX 99889027 99890174 I4 -
chrX 99890250 99890554 I3 -
chrX 99890744 99891187 I2 -
chrX 99892102 99894941 I1 -
chr20 49552800 49557401 I8 -
chr20 49557493 49557641 I7 -
chr20 49557747 49558567 I6 -