Skip to content
Advertisement

how to count repeated sentence in Shell

JavaScript

My expected result is like as below:

JavaScript

I have found a way to deal with the issues, but my code is a little noisy.

JavaScript

I was wondering if you could show me more high-efficiency way to achieve the goal.Thanks a lot.

Advertisement

Answer

If you’re lines are not already grouped, then you could use

JavaScript

This will consume a lot of memory if your file is very large. You might want to sort it first.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement