Re: sorting dates in ksh
Posted in 2004
chris.staubin@reebok.com wrote: > Greetings, Download my date library (datelib_ak) from the IIUG Software Repository. The low level getdateandtime() function and its higher level children (strtoidate, strtodate4, strtodate6 converts strings containing dates into an internal structure ideal for date sorting. You can then write a simple, or more complex, file sort utility using that function. Art S. Kagel > I need help figuring out a way to sort out the data sample below. I want > to sort it by the second field first, then the thierd field. The goal is > to present the data by date then time in ascending order. I'm working in > HPUX ksh. > > I tried sort -k against field 2 and it won't sort. I suspect the forward > slashes need to be defined in some way... or somthing. I can't find the > answer in the man page or on the Internet. > > Can anyone provide a sort command that will sort by $2 then $3? > > Thanks, > -Chris > > Harry 05/04/04 10:45:00 > Bill 05/03/04 19:00:00 > Sally 05/04/04 06:30:00 > Ben 05/03/04 23:30:00 > Jimmy 05/04/04 00:30:00 > Benny 05/03/04 18:30:00 > Mike 05/03/04 20:30:00 > Susan 05/03/04 21:00:00 > Larry 05/03/04 21:30:00 > Joe 05/03/04 22:00:00 > Nancy 05/09/04 09:30:00 > George 05/09/04 11:00:00 > sending to informix-list