How to increment and keep previous increments when values are the same in emacs <p>I have two columns with values, the second column starts at particular value, I want the second column to start with one, and increment only whenever a value changes, otherwise keep the previous increment. I can use macro to set the start count, but how to make sure that same values remains the same as shown ?, </p> <p>Problem: </p> <pre><code>0,39 1,39 2,39 3,39 4,40 5,40 6,40 7,41 </code></pre> <p>I want this: </p> <pre><code>0, 1 1, 1 2, 1 3, 1 4, 2 5, 2 6, 2 7, 3 </code></pre>