Skip to content

Instantly share code, notes, and snippets.

@chluehr
Created September 15, 2010 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chluehr/581090 to your computer and use it in GitHub Desktop.
Save chluehr/581090 to your computer and use it in GitHub Desktop.
Count number of unique lines in a file
#!/bin/sh
# sample.csv contains: <id>;<data> , e.g. 33;fooooo
# script counts how many lines with the same id exist, cnt DESC
cut -f1 -d\; sample.csv | uniq -c -d | sort -n -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment