Sort Command #1 HackerRank Solution

Hello Programmers, In this post, you will know how to solve the Sort Command #1 HackerRank Solution. This problem is a part of the HackerRank Linux Shell Series.

Ezoicreport this adSort Command #1 HackerRank Solution
Sort Command #1 HackerRank Solutions

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Ezoicreport this adProblem

In this challenge, we practice using the sort command to sort input in text or TSV formats.

Given a text file, order the lines in lexicographical order.

Input Format

A text file.

Output Format

Output the text file with the lines reordered in lexicographical order.

Sample Input

Dr. Rajendra Prasad January 26, 1950 May 13, 1962
Dr. S. Radhakrishnan May 13, 1962 May 13, 1967
Dr. Zakir Hussain May 13, 1967 August 24, 1969
Shri Varahagiri Venkata Giri August 24, 1969 August 24, 1974
Shri Fakhruddin Ali Ahmed August 24, 1974 February 11, 1977
Shri Neelam Sanjiva Reddy July 25, 1977 July 25, 198

Sample Output

Dr. Rajendra Prasad January 26, 1950 May 13, 1962
Dr. S. Radhakrishnan May 13, 1962 May 13, 1967
Dr. Zakir Hussain May 13, 1967 August 24, 1969
Shri Fakhruddin Ali Ahmed August 24, 1974 February 11, 1977
Shri Neelam Sanjiva Reddy July 25, 1977 July 25, 198
Shri Varahagiri Venkata Giri August 24, 1969 August 24, 1974

Sort Command #1 HackerRank Solutions

#Display the last 20 characters of an input file.
tail -c 20

Note: This problem (Sort Command #1) is generated by HackerRank but the Solution is Provided by  BrokenProgrammers. This tutorial is only for Educational and Learning purposes.

Next: Sort Command #2 HackerRank Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad