Re: sorting dates in ksh
Posted in 2004
Hi everybody, I just ask you all: Why not sort this output BEFORE ? Where you get that resultset ? Remember in unix Ksh you can get in separate year, month, day, hour, minute, second ... > date +%y%m%d (you receive from OS 20040505 if you want) > date +%y'/'%m'/'%d ( you receive: 2004/05/05 ) > date +%y%m%d%H%M%S ( you receive: 20040505145559 ) It helps you ??? BR R.Ferronato "Jack Parker" <vze2qjg5@verizon.net> wrote in message news:<c76u44$5qu$1@terabinaries.xmission.com>... > Do a man sort - there are options there to sort by date. > > cheers > j. > ----- Original Message ----- > From: <chris.staubin@reebok.com> > To: <informix-list@iiug.org> > Sent: Monday, May 03, 2004 3:13 PM > Subject: sorting dates in ksh > > > > Greetings, > > > > 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 > > > > sending to informix-list