I don’t do this stuff for a living so forgive me if it’s a simple question (or more complicated than I think). I‘ve been digging through the archives and found a lot of tip
With awk :
awk '$1!=p+1{print p+1"-"$1-1}{p=$1}' file.txt
$1 is the first column from current input linep is the previous value of the last line($1!=p+1) is a condition : if $1 is different than previous value +1, then :{print p+1 "-" $1-1} : print previous value +1, the - character and fist columns + 1{p=$1} is executed for each lines : p is assigned to the current 1st column