Help answer threads with 0 replies.
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, 01: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, 01:28 PM   #2
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548

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 27 10-20-2017 04:45 AM
How to redirect output to a file? mus1402 Linux - Newbie 2 02-05-2006 10:42 AM
redirect screen output to file timbuck Linux - Software 5 12-09-2005 07:57 PM
how to redirect the soundcard output to a file? jr0 Linux - General 2 10-31-2005 07:29 AM
output from cpio won't redirect to file rawii Programming 5 01-27-2004 02:49 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:03 PM.

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
Open Source Consulting | Domain Registration