Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
What you want is possible in two ways:
1. cat file | sort > file.tmp; mv file.tmp file
2. Modifying a file via perl/sed/whatever-has-similar-features, launched with the -i option (actually they do the first step, but you don't see it)
This cannot be done because most programs are normal, and do not read the entire file at once, but use buffers for this, read a part, displayed, read a part, displayed.
To do what you want, you just need to find a program (option) that reads the entire file before outputting it.
Hurry up =) here's a solution for you:
sort file >> file
The sort command reads the entire file into memory before sorting, which is not surprising.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question