Given a sorted file like so:
AAA 1 2 3
AAA 2 3 4
AAA 3 4 2
BBB 1 1 1
BBB 1 2 1
and a desired output of
AAA 1 2 3
BBB 1 1 1
what’s the best way to achieve this with sed?
Basically, if the col starts with the same field as the previous line, how do I delete it? The rest of the data must be kept on the output.
I imagine there must be some way to do this either using the hold buffer, branching, or the test command.
another way with awk: