I have problems with AWK command. When I used this code is:
$ awk '{a[NR]=$1}
END {for (i=0;i<NR;i++)
{B=a[i+1];A=a[i];C=(B-A);D=int(C/16)}
{for (j=0;j<=D;j++)
{if(C!=16) {print t=A;A=A+16;B} else {print A}}
}}' 19.txt
My input file "19.txt" is :
1510
1526
1542
1558
1614
1630
1646
1702
1802
I got this out:
1702
1718
1734
1750
1766
1782
1798
My code only use the difference of the last lines, why?? I want to complete the spaces between consecutive lines, where the different between lines is equal to 16, similar to this:
1510
1526
1542
1558
----
1574
1590
1606
----
1614
1630
1646
----
1662
1678
1694
----
1702
----
1718
1734
1750
1766
1782
1798
----
1802