thank you a lot,you are right!it is not so clear my explanation!
so...the input file is composed by intervals of different lenght of piece of genes (the name is in the first column).I have to split these intervals in smaller intervals of 200, considering to "complete the gap" among the intervals. At the same time, the intervals have to be of 200 but the next start has to be 200+2.
To make it easier..
this is an easier input file.
The intervals I have to create is 10
input.txt
gene1 chr1 10 25
gene1 chr1 46 99
gene1 chr1 103 190
gene2 chr4 50 63
gene2 chr4 90 110
output.txt
gene1 chr1 10 20
gene1 chr1 22 53
gene1 chr1 55 65
gene1 chr1 67 77
gene1 chr1 79 89
gene1 chr1 91 99
gene2 chr4 50 60
gene2 chr4 62 99
gene2 chr4 101 110