I run into this problem a lot with data, if I have some integers, I frequently want to look at differences between adjacent integers, I usually solve this in Ruby or Python, but I think such a thing could be done in awk, and I'd prefer that.
I have a table of data such as:
201309,694
201310,699
201311,700
201312,705
201401,713
201402,740
And I would like to find the adjacent differences, that is:
201310-201309,699-694
201311-201310,700-699
201312-201311,705-700
201401-201312,713-715
201402-201401,740-713
I found the function getline in the awk manpage, but I haven't been able to use it successfully.