LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-19-2005, 10:23 AM   #1
lluciano
LQ Newbie
 
Registered: Feb 2004
Distribution: FC4
Posts: 19

Rep: Reputation: 0
Sorting data in output file


I need to sort lines in an output file according to numerical data in column one, as seen in the following example:

2080 /example/path/bin/file1
1219 /example/path/bin/file2
3 /example/path/bin/file3
7 /example/path/bin/file4
3 /example/path/bin/file5
2 /example/path/bin/file6
28 /example/path/bin/file7
24 /example/path/bin/file8
188 /example/path/bin/file9
40 /example/path/bin/file10

Needs to be grepped out to another output file or sorted to look like this:

2080 /example/path/bin/file1
1219 /example/path/bin/file2
188 /example/path/bin/file9
28 /example/path/bin/file7
40 /example/path/bin/file10
24 /example/path/bin/file8
7 /example/path/bin/file4
3 /example/path/bin/file3
3 /example/path/bin/file5
2 /example/path/bin/file6

It can be done easy enough by importing the data in MS Excel, but this needs to be done locally on our LINUX and HP servers. Any help would be appreciated and thanks..
 
Old 08-19-2005, 10:48 AM   #2
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
Code:
sort -gr outputfile > new_output
 
Old 08-19-2005, 11:37 AM   #3
lluciano
LQ Newbie
 
Registered: Feb 2004
Distribution: FC4
Posts: 19

Original Poster
Rep: Reputation: 0
Thank you. Here is the equivalent for HP UX:

sort -nr out > new_out
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Culling Data from a CSV file to output in excel jterr02 Programming 2 05-19-2006 05:58 AM
Sorting data. unreal128 Linux - Software 1 09-20-2005 07:31 PM
Sorting a file containing dates subu_s Linux - General 2 06-03-2004 02:07 PM
File sorting problem Kerridis Linux - General 3 03-08-2004 11:44 PM
Sorting of multi-column output rytrom Linux - Newbie 11 09-15-2003 12:31 PM


All times are GMT -5. The time now is 09:07 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