How to explicit the intervals between numerical values in a file? (better if an awk one-liner)Input:A    1-3B    5-7OutputA    1,2,3B    5,6,7Code I've tried so far: sed -i 's/-/\t/g' input #splits the digits to separated columnsawk '{print$1\t$3-$2+1}' input > output #prints key and interval widthBut, thid only allows computing the number of values within the interval. For example, the output will look like:A    3B    3
Calculate intervals
awk
Personally, I would do this by taking advantage of the shell's brace expansion:$ while read a b; do echo $a $(eval echo {$(sed 's/-/../' <<<$b)}); done < fileA 1 2 3B 5 6 7or, to have comma separated values$ while read a b; do     echo $a $(eval echo {$(sed 's/-/../' <<<$b)} | sed 's/ /,/g');   done < fileA 1,2,3B 5,6,7Since you asked for an awk one liner, you could try:$ sed 's/-/ /' file |     awk '{printf %s , $1; for(i=$2;i<=$NF-1;i++){printf %d,, i}; print $NF}' A 1,2,3B 5,6,7or, to do the whole thing in awk:$ awk '{gsub(/-/, )}{printf %s , $1;                        for(i=$2;i<=$NF-1;i++){printf %d,, i}; print $NF}' fileA 1,2,3B 5,6,7