john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Sort uniq tr tolower remove duplicates

sort a text file, then see how many lines are unique:

sort myfile.txt | uniq -u | wc -l (count the number of unique entries in a file) sort myfile.txt | uniq -d | wc -l (count the number of lines that are duplicates in a file) sort myfile.txt | uniq -dc (display the number of duplicates for each line in a file)

tr "[:upper:]" "[:lower:]" < myfile.txt | sort (translate all of the uppercase letters to lowercase)

tr "[:upper:]" "[:lower:]" < myfile.txt | sort | uniq -u > unique-sorted-lowercase-myfile.txt


  • « win7 startup bat with admin privileges task
  • Vmware ssh esx vsphere »

Published

Dec 28, 2011

Category

linux

~82 words

Tags

  • duplicates 1
  • linux 249
  • remove 16
  • sort 11
  • tolower 1
  • tr 1
  • uniq 1