Hello, I am really having a trouble on something that at first glance seemed easy to do in awk...
I am attempting to reformat a file that has two colums, such as below:
201 84
201 370
201 544
201 600
213 99
213 250
213 431
220 65
220 129
220 338
220 408
220 501
220 550
231 101
231 350
The idea is to add a third column containing a numeric value (a sort of flag) that increments by a value of 1 (one) as the first column value changes (the value of the first column itself is irrelevant, the important thing is to track when the value changes..). The output should be something like this:
201 84 1
201 370 1
201 544 1
201 600 1
213 99 2
213 250 2
213 431 2
220 65 3
220 129 3
220 338 3
220 408 3
220 501 3
220 550 3
231 101 4
231 350 4
...and so on...
I have tried with the arithmetic and incremental operators but I did not get good results. I will deeply appreciate any help on this from any of the awk gurus..!
Thanks!