Abstract

The Uniq Command 1 problem from HackerRank.

Uniq Command 1#

Uniq Command 1 | HackerRank

Problem#

Uniq Command 1

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#

#!/usr/bin/env bash

# shellcheck disable=SC2162
uniq < /dev/stdin