File sorting question

From: Nik (ndodnnn_at_yahoo.com)
Date: 05/13/03


Date: 13 May 2003 11:00:51 -0700

Hi all,

I need a quick way to sort a file (ksh, awk, perl are all fine).
The file looks like this:

P|3BLEE1E |01-JAN-2002|N|C| 2046284.28| |CAD
P|3BLEE1E |01-APR-1999|N|C| 1787056.18| |CAD
P|3BLEE1E |01-MAY-1999|N|C| 1750609.37| |CAD
P|3BLEE1E |01-MAY-2001|N|C| 2331432.6| |CAD
P|3BLEE1E |01-JUN-2001|N|C| 2308868.41| |CAD
P|3BLEE1E |01-AUG-1977|N|C| 237115| |CAD
P|3AAAFFR |01-MAY-2001|N|C| 2331432.6| |CAD
P|3AAAFFR |01-SEP-1977|N|C| 237290| |CAD
P|3AAAFFR |01-OCT-1977|N|C| 237290| |CAD
P|3AAAFFR |01-FEB-1978|N|C| 271750| |CAD

The sorting criteria is as follows: First, based on the second field
(such as 3BLEE1E) and second based on the third field ( a date field).
I know ksh sort can handle dates in this format but how do I specify
that in conjuction with the primary sorting criteria.

TIA,

NIK



Relevant Pages

  • Re: File sorting question
    ... >I need a quick way to sort a file (ksh, awk, perl are all fine). ... >that in conjuction with the primary sorting criteria. ...
    (comp.unix.shell)
  • RE: [opensuse] OT: bash F1
    ... You should sort your result because ls garantees no particular order ... You don't need expr as long as you are using bash or ksh or zsh or ... In ksh you don't need to spawn a sub shell just to use printf just to ...
    (SuSE)
  • Re: sorting K+1 vectors with NlogN comparisons not (K+1)NlogN
    ... using a sorting criteria that looks up elements in the A ... // sort using index sort mechanism as suggested by tom_usenet ... // basically the while-loop in index-shuffle will loop twice. ...
    (comp.lang.cpp)
  • parameter for Asc Desc sort
    ... For a sorting formula that uses a paramater such as ... //Output 1st Sorting criteria ... Problem is you cant toggle the sort. ... It sorts fine if i dont use the formula and use sort expert on the CustPart ...
    (microsoft.public.vb.crystal)
  • Re: Urgent: Need an integer for loop for renaming files
    ... > If you have ksh, a general solution to this sort of renaming problem is ...
    (comp.unix.shell)