1

Unique lines based on the first field

view story
linux-howto

http://unix.stackexchange.com – How can you find unique lines or duplicate lines in a file based on the content of the first field, or the first n characters ? The uniq command on OS X lacks the -w switch that is available under Linux: -w, --check-chars=N : compare no more than N characters in lines, which solves the problem. Can it be done without reimplementing uniq in awk ? The number of fields is not constant. I would like to use only default tools installed on OS X. I use Macports a lot, but in this case, I don't want to use them. (HowTos)