Sort/Uniq: Difference between revisions

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..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
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 on the 3rd field using ',' as field seperator


;uniq -d
;uniq -d

Latest revision as of 11: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