The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to sort a field in a file having date values risshanth Shell Programming and Scripting 4 06-04-2008 05:03 AM
Remove lines, Sorted with Time based columns using AWK & SORT karthikn7974 Shell Programming and Scripting 1 05-09-2008 11:04 PM
How to sort alphabetically after finding values doubleminus UNIX for Dummies Questions & Answers 4 04-28-2008 06:45 AM
How to sort decimal values in bash ahjiefreak Shell Programming and Scripting 1 01-21-2008 09:25 AM
sort mail based on subject in unix. sriram.s Shell Programming and Scripting 2 02-02-2007 07:38 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-17-2004
p_prathaban p_prathaban is offline
Registered User
  
 

Join Date: Feb 2004
Posts: 11
How to Sort files based on predefined values.?

How to Sort files based on predefined values.?
Normally Sorting happens for the alphabetic or numberic orders..
Is there any way to sort a fields based on the Field values..?

Field10 has :
one
two
three
five
four
six
ten
seven
eight
nine.

in predefined order { one, two, three, four, five, six, seven, eight, nine, ten}

I need in Unix Script.

Thanks in Advance.
  #2 (permalink)  
Old 02-17-2004
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
you can use awk.
you can use perl.

we are not here to do the work for you.

all you really need to do is get that field in the front of your line and then sort it out.

Last edited by Optimus_P; 02-17-2004 at 11:06 AM..
  #3 (permalink)  
Old 02-17-2004
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
These seems a little more unique than some questions though - not simply a case of reading the man page for "sort".

p_prathaban, I think you need to look at how the file was created (what script created it? was it simply typed up?) and why someone would choose to create it with the names of numbers instead of the actual numbers themselves...

What exactly is it you're trying to do, since I doubt you're just sorting files in your spare time?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0