serhii.net

In the middle of the desert you can say anything you want

08 Oct 2020

Day 647

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.

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus