Skip to content

Instantly share code, notes, and snippets.

@jbranchaud
Created December 14, 2011 17:19
Show Gist options
  • Save jbranchaud/1477523 to your computer and use it in GitHub Desktop.
Save jbranchaud/1477523 to your computer and use it in GitHub Desktop.
Get a sorted list of unique items in a file with their number of occurrences.
#!/bin/bash
# Given a file, output a sorted list of unique items with the number of occurrences for each item next to it
fname=$1
cat $fname | sort | uniq -c
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment