Reputation: 2331
I can't just use rev because each row may have 2 to 8 columns but basically I just want to use uniq but only based on the first column and not every column after.
Upvotes: 0
Views: 308
Reputation: 8395
From man uniq
and other onlie sources (e.g. that one: http://www.folkstalk.com/2012/10/uniq-command-examples-in-unix-and-linux.html),
The -f option is used to skip the first N columns in comparison.
So you'd rather use sort
like below, to keep lines in a.txt that are unique regarding the first column:
sort -k 1,1 -u a.txt
hope this will help.
Upvotes: 1