Is there a way to unique by column/field?
Hello folk,
Is there a command in CentOS to unique by column/field? My file looks like below : [root@mitter log]# cat test,txt test test2 test3 test4 test2 test1 test2 test4 and desired output : test test2 test2 test1 test3 test4 |
When looking at your example: Nope.
There's no way to know which of these 2 need to be removed: Code:
test2 test1 Here's a way to only show the first occurrence: Code:
awk '!($1 in array) { array[$1]; print}' <( sort test.txt ) Code:
awk '!($1 in array) { array[$1]; print}' <( sort -r data.file ) | sort |
Hello Druuna,
Thanks! ref : http://stackoverflow.com/questions/1...915773#1915773 sort -u -t, -k1,1 file |
All times are GMT -5. The time now is 04:40 PM. |