When we use sort file command,
the file shows its contents in a sorted way what if I don\'t want to get any-kind of output but a sorted file?
You can use file redirection to redirected the sorted output:
sort input-file > output_file
Or you can use the -o, --output=FILE option of sort to indicate the same input and output file:
sort -o file file
⚠️ Note: A common mistake is to try to redirect the output to the same input file
(e.g. sort file > file). This does not work as the shell is making the redirections (not the sort(1) program) and the input file (as being the output also) will be erased just before giving the sort(1) program the opportunity of reading it.