3
Contributors
3
Replies
19
Views
2 Years
Discussion Span
Last Post by Gribouillis
0

@MarkQ97
If I want to sort a file I can do this with a pipe.
cat file | sort -r > newfile

The sort flags are picked as you wish and my crude example is just that.

Your reply about a directory seems odd but I take it you need a reminder of Linux command lines. One can also not pipe but redirect like:
sort -r < file > newfile

And for more fun you can get the last so many lines with tail then sort like:
tail file|sort -r > newfil

1

Isn't it an example of UUOC ? It seems to me that sort -r -o newfile file should work.

Votes + Comments
Some folk need to see more examples. even sort -r file.txt should work but they may be quite new to the command line.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.