Quantcast
Channel: Count how many times each line appears in a file - Unix & Linux Stack Exchange
Browsing all 3 articles
Browse latest View live

Answer by DisgruntledGoat for Count how many times each line appears in a file

I just came here with a similar problem. From this, I managed to put together a slightly more advanced command, which I hope is useful for others.As Steven D said in the comments above uniq only counts...

View Article



Answer by Cheng for Count how many times each line appears in a file

I figured it out; one of uniq's options is -c, for "prefix lines by the number of occurrences":$ uniq -c

View Article

Count how many times each line appears in a file

Say I have a file which contains:AAABCCI want to have the output like this:A 3B 1CC 1

View Article
Browsing all 3 articles
Browse latest View live




Latest Images