Counting words/characters (Why I like Unix)

(No, not me. Him.)

Word frequencies


cat hfinn10.txt
  | tr '[:punct:]'  ' '
  | tr ' ' '\012'
  | sort
  | uniq -c
  | sort -n
  | tail -20

Character frequencies


cat hfinn10.txt
  | sed 's/./&~/g'
  | tr '~' '\012'
  | sort -n
  | uniq -c
  | sort -n
  | tail -20

more plumbing magic …

Published by

bact

bact' is a name

Leave a Reply