grep / uniq magic

uniq can compare stuff before / after N characters in the string, group together duplicate ones, etc!

  • uniq -w N looks at only the N first characters.
  • uniq -s N don’tt look at the first N characters
  • uniq --all-repeated[=METHOD] prints all duplicated lines and optionally separates them via METHOD. separate is really nice as method.
  • uniq -c prefixes line by number of occurrences of that line

And I guess again - uniq works only on sorted data.