Skip Navigation Bar
NLM logo

sort-uniq-count-rank


Please note: following the release of the new version of PubMed, the results returned by E-utilities queries of PubMed may differ slightly from those returned in the web version of PubMed. A new PubMed API is currently under development: more information will be announced when available.

As new Insider's Guide classes are no longer being offered, this site is not currently being updated. Please refer to NCBI's E-utilities documentation for more up-to-date information.


The sort-uniq-count-rank command combines a series of Unix commands (including sort and uniq) to sort a series of lines of text alphabetically, grouping together the duplicate lines. The function then counts how many occurrences there are of each unique line, removes all duplicate lines, and then sorts the list of unique lines by how frequently they occur, from most frequent to least frequent. The numerical frequency count is also displayed.

Input

One or more lines of text.

Output

One or more unique lines of text, accompanied by frequency counts, sorted from most frequent to least frequent.

Arguments

The sort-uniq-count-rank command does not accept arguments.

Example

Given a series of rows of text (for example, a list of author names):

Noy S
Iverson GL
Del Bigio MR
Sawyer Q
Vesci B
Zukerman SL
Iverson GL
Wallace PW
Stern RA
Noy S
Baugh CM
[...]

The sort-uniq-count-rank command will output:

12      Iverson GL
12      Zuckerman SL
11      Guskiewicz KM
11      Kerr ZY
11      Solomon GS
10      Covassin T
10      Stern RA
9       Arnett PA
9       Baugh CM
9       Kroshus E
9       Mihalik JP
[...]

Last Reviewed: July 30, 2021