4 ms·
That looks like it was a sample line that wasn't particularly useful, but if you do: cat file.txt | sort | uniq | wc -l ## notice uniq it gives you the count
by iigs 17y ago
That looks like it was a sample line that wasn't particularly useful, but if you do:
cat file.txt | sort | uniq | wc -l ## notice uniq
it gives you the count of unique lines. If you omit the sort in that instance it will fold duplicates together a/b/a is three lines, not two.
- gnosis 17y agoInstead of "sort | uniq" you could just use "sort -u"