'Uniq' Command #3, is a HackerRank problem from Text Processing subdomain. In this post we will see how we can solve this challenge in Sh

Problem Description

Given a text file, count the number of times each line repeats itself (only consider consecutive repetions). Display the count and the line, separated by a space. There shouldn't be leading or trailing spaces. Please note that the uniq -c command by itself will generate the output in a different for ....

You can find the full details of the problem 'Uniq' Command #3 at HackerRank

Solution: Please check the the-uniq-command-3.sh snippet for the solution.

This solution originally posted at: Github by @srgnk