When looking at your example: Nope.
There's no way to know which of these 2 need to be removed:
Code:
test2 test1
test2 test4
You can get rid of the first one or the last one, but both are unique.
Here's a way to only show the first occurrence:
Code:
awk '!($1 in array) { array[$1]; print}' <( sort test.txt )
This only shows the last one:
Code:
awk '!($1 in array) { array[$1]; print}' <( sort -r data.file ) | sort