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.
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
0 Comments