Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

HackerRank Sort Command #2 problem solution

YASH PAL, 31 July 2024

In this HackerRank Sort Command #2 problem solution In this challenge, we practice using the sort command to sort input in text or TSV formats. we have given a text file, order the lines in reverse lexicographical order (i.e. Z-A instead of A-Z).

Input Format

A text file.

Output Format

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

HackerRank Sort Command #1 problem solution

Problem solution.

sort -r

Second solution.

echo "$(</dev/stdin)" > file1234
sort -r file1234

Third solution.

cat > file
sort -r -t " " -k1 file -o output
cat output

coding problems solutions linux shell

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes