Difference between revisions of "Sort/Uniq"

From wiki
Jump to navigation Jump to search
 
Line 7: Line 7:
 
;sort -u
 
;sort -u
 
:Sort and print all unique values
 
:Sort and print all unique values
 +
 +
;sort -n
 +
:sort numeric
  
 
;sort -t"," -k3
 
;sort -t"," -k3

Latest revision as of 13:48, 22 August 2023


sort <filename>
cat <filename>|sort
Print the content of <filename> sorted.
sort -u
Sort and print all unique values
sort -n
sort numeric
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