Tag Info

New answers tagged

6

If you want to sort/test for uniqueness the first field specifically, and your system has the GNU coreutils version of sort, then I think you could just use sort -nu file viz. $ sort -nu file 123 some text 334 some other text 341 more text From info coreutils 'sort invocation' The commands sort -u and sort | uniq are equivalent, but this ...


3

Try this awk: awk '!($1 in a){a[$1];print}' file 123 some text 334 some other text 341 more text This assumes that file was sorted.



Top 50 recent answers are included