Issue
How can I sort a list of words
apple
banana
orange
healthy
by the reverse of the words, the result should be
banana
orange
apple
healthy
Solution
Use the rev
utility to reverse lines characterwise. Then rev
again.
$ cat input.txt | rev | sort | rev
banana
orange
apple
healthy
Edit 1
As pointed out by @dan, the better solution is to do rev input.txt | sort | rev
.
Answered By - philiptomk Answer Checked By - David Goodson (WPSolving Volunteer)