How to find unique fields in a tab delimited file in Linux

Use cut, sort & uniq commands to do the same

cat file_name| cut -f 1 | sort | uniq

will display values in field1 ,same way you can replace 1 with 2,3 etc…

Toget the unique occurrences you can make use of wc command as

cut -f 1 file_name| sort | uniq | wc -l

abhilash

abhilash, is a programmer by profession and a technology addict with a passion towards browsing , shopping and imaging . My views may be biased on reviews. all images and videos are copyrighted to respective owners.

Add comment

Your Header Sidebar area is currently empty. Hurry up and add some widgets.