Am I blind or is there no option like --in-place for sort?
In order to save results to the input file, sed uses -i (--in-place).
Redirecting the output of sort to the input file
sort < f > f
results in making it empty. If there is no --in-place option - maybe there is some trick how to do this in handy way?
(The only thing that cames to my mind:
sort < f > /tmp/f$$ ; cat /tmp/f$$ f ; rm /tmp/f$$
Moving is not right choice, cause file permissions might be changed. That's why I overwrite it with contents of tmp which I then remove.)
insitu, allowing any commands to be used in-place. – sr_ Jan 22 '12 at 10:19sort. – cjm Jan 22 '12 at 11:09