Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-21-2007, 12:17 PM   #1
Registered: Feb 2002
Distribution: Gentoo
Posts: 95

Rep: Reputation: 15
output redirect back to file

Is there a way to do the following:

sort file > file
without doing

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
Old 03-21-2007, 12:28 PM   #2
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 542

Rep: Reputation: 33
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH: How to Redirect Output to File, AND Still Have it on Screen edwin11 Linux - Software 25 07-02-2012 06:12 PM
How to redirect output to a file? mus1402 Linux - Newbie 2 02-05-2006 09:42 AM
redirect screen output to file timbuck Linux - Software 5 12-09-2005 06:57 PM
how to redirect the soundcard output to a file? jr0 Linux - General 2 10-31-2005 06:29 AM
output from cpio won't redirect to file rawii Programming 5 01-27-2004 01:49 PM

All times are GMT -5. The time now is 06:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration