Horje
bash sort strings by frequency Code Example
bash sort strings by frequency
# Basic syntax:
cat your_file | sort | uniq -c | sort -nr
# Where:
#	- you can replace cat your_file with any command that produces output
#		you want to sort in this way
#	- sort sorts the input it gets from the upstream command and sorts it in
#		alphanumeric order
#	- uniq -c counts the number of occurrences of each line
#	- sort -nr sorts the input it gets numerically in reverse order (high to
#		low)
# Note, you have to sort before passing to uniq -c because uniq -c counts
#	adjacent lines that are identical (and resets the count if they aren't)




Shell

Related
grepper brazil Code Example grepper brazil Code Example
convert epoch timestamp to human readable format on osx Code Example convert epoch timestamp to human readable format on osx Code Example
tail colored Code Example tail colored Code Example
add a linux header ubuntu 18.04 Code Example add a linux header ubuntu 18.04 Code Example
errno 2 no such file or directory less Code Example errno 2 no such file or directory less Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12