I have an input file in the following format.
#track
chr11 61731756 61735132 FTH1 -
chr12 6643584 6647537 GAPDH +
chr11 18415935 18429765 LDHA +
chr12 21788274 21810728 LDHB -
chr22 24236564 24237409 MIF +
chr4 6641817 6644470 MRFAP1 +
chr15 72491369 72523727 PKM -
chr10 73576054 73611082 PSAP -
chr2 85132762 85133799 TMSB10 +
chr13 45911303 45915297 TPT1 -
I want to get an output file in which if the 5th column is + then subtract 5000 from column 2 and add 2000 to column 3 so as to output following
chr11 18410935 18431765 LDHA +
chr2 85127762 85135799 TMSB10 +
If the 5th column is "-", then add 5000 to column 3 and subtract 2000 from column 2 so as to get following output
chr11 61729756 61740132 FTH1 -
chr12 21786274 21815728 LDHB -
So I want the output to be in the same order as input. Also I want to output the first line #track as it is.
I want to do this in awk. How can I perform this.