LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 09-20-2005, 06:51 PM   #1
unreal128
Member
 
Registered: Jun 2003
Distribution: SuSE, Slackware, Gentoo
Posts: 207

Rep: Reputation: 30
Sorting data.


I have a text file of lines that all conform to the same structure...

003555 Failed for 4 days with token status 0000
002869 Failed for 12 days with token status 0000
002681 Failed for 2 days with token status 0000

What I am trying to do is re-sort the text file according to the "X days" criteria; the text file will redisplay showing the ID with the most days failed on top and then chronologically descend like...

002869 Failed for 12 days with token status 0000
003555 Failed for 4 days with token status 0000
002681 Failed for 2 days with token status 0000

What is most efficient way to do this (awk, sort) and how would I go about executing this?

BTW, if anyone has a great tutorial on Awk, please send it my way. I am trying to learn as much as possible.
 
Old 09-20-2005, 07:31 PM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
Code:
sort -nr +3 <file>
 
  


Reply


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
sorting problem ltordsen Programming 2 11-02-2005 04:25 PM
Sorting data in output file lluciano Linux - General 2 08-19-2005 11:37 AM
sorting and stuff arnulfo Programming 13 01-01-2005 05:37 PM
Sorting Beppe83 Linux - Software 7 06-21-2004 10:10 AM
Sorting question AMMullan Linux - General 12 01-19-2004 04:09 PM


All times are GMT -5. The time now is 11:46 PM.

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