I have a two-column file:
1,112 1,123 2,123 2,124 2,144 3,158 4,123 4,158 5,123
I need to know last column2 value for each column1:
<
This is pretty similar to @Sundeep's solution but here it goes:
$ tac file|uniq -w 1|tac 1,123 2,144 3,158 4,158 5,123
ie. reverse the record order with cat, uniq outputs based on the first character only and then the order is reversed again.
cat
uniq