In this post, we will solve ‘Tr’ Command #3 HackerRank Solution. This problem (‘Tr’ Command #3) is a part of Linux Shell series.
Task
In a given fragment of text, replace all sequences of multiple spaces with just one space.
Input Format
A block of ASCII text.
Output Format
Replace all sequences of multiple spaces with just one space.
Sample Input
He llo
Wor ld
how are you
Sample Output
He llo
Wor ld
how are you
Solution – ‘Tr’ Command #3 – HackerRank Solution
#Replace all sequences of multiple spaces with just one space. tr -s ' '
Note: This problem (‘Tr’ Command #3) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.