‘Uniq’ Command #1 – HackerRank Solution

In this post, we will solve ‘Uniq’ Command #1′ HackerRank Solution. This problem (Uniq Command #1) is a part of Linux Shell series.

Task

In this challenge, we practice using the uniq command to eliminate consecutive repetitions of a line when a text file is piped through it.

Given a text file, remove the consecutive repetitions of any line.

Sample Input

00
00
01
01
00
00
02
02

Sample Output

00
01
00
02  

Solution – ‘Uniq’ Command #1 – HackerRank Solution

#Given a text file, remove the consecutive repetitions of any line.
uniq

Note: This problem (‘Uniq’ Command #1) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *