LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   output redirect back to file (http://www.linuxquestions.org/questions/linux-software-2/output-redirect-back-to-file-539378/)

mathfeel 03-21-2007 12:17 PM

output redirect back to file
 
Is there a way to do the following:

Code:

sort file > file
without doing

Code:

sort file > file2
mv file2 file

basically, sort the file and put the output back in the file without having to generate an intermediate file

DotHQ 03-21-2007 12:28 PM

To do this process with a script is pretty easy.
And .... I thought I have seen it done via command line by using the < redirect sysbol to direct the output back into the origial file ....but i tried it on RH and it did not work as expected. I would recommend using a script anyway to save possible data corruption. Just my 2cents. :D


All times are GMT -5. The time now is 03:28 AM.