Difference between revisions of "Sort/Uniq"

From wiki
Jump to navigation Jump to search
(Created page with "Category:Linux/Unix ;sort <filename> ;cat <filename>|sort :Print the content of <filename> sorted. ;sort -u :Sort and print all unique values ;uniq -d :Print all values...")
 
Line 7: Line 7:
 
;sort -u
 
;sort -u
 
:Sort and print all unique values
 
:Sort and print all unique values
 +
 +
;sort -t"," -k3
 +
:Sort on the 3rd field using ',' as field seperator
  
 
;uniq -d
 
;uniq -d

Revision as of 11:30, 25 May 2020


sort <filename>
cat <filename>|sort
Print the content of <filename> sorted.
sort -u
Sort and print all unique values
sort -t"," -k3
Sort on the 3rd field using ',' as field seperator
uniq -d
Print all values that exist more than once
uniq -D
Print all lines with duplicate values