84.2k views
4 votes
Every time your friend types the command ""sort May-2014 > May-2014"" the file is empty when he/she opens it. Since you are an expert at Linux you explain to him/her why this is the case and how to use the command properly so he/she does not overwrite file again. Please explain how your friend can avoid this issue in the future.

User Sspross
by
3.7k points

1 Answer

2 votes

Answer:

Step-by-step explanation:

The intent of the sort command is to order the file text content, alphabetically, line by line, or in reverse form if -r in front is used.

I would inquire from my friend if he's trying to write the output to a new file, if that is so then the out file has to be different.

E.G : sort May-2014> May-2014_output.

To check the output of the file they can use the "cat" command, this is unveil in the sorted data.

The command -o is disclosed if there is a need to specify the output file.

Example : sort -o May-2014_output May-2014.

User Aneurinc
by
3.4k points