Sorting confusion
- From: "C." <colin.mckinnon@xxxxxxxxx>
- Date: Sun, 9 Dec 2007 04:17:44 -0800 (PST)
Hi all,
I'm having a problem using 'sort' to pre-process log files. I'm not
getting my output sorted as I expect:
Given an input set:
2007-12-04 20:33:10.587532 "35:1196800053:389002" a
2007-12-04 20:30:25.384069 "35:1196800053:389002" b
2007-12-04 20:33:25.384069 "25:1196800053:389002" c
(fields are date, time, session id, something else)
I want to sort by the session id then by the time:
sort -t \t -k 3,3 -k 1,2 <test
2007-12-04 20:30:25.384069 "35:1196800053:389002" b
2007-12-04 20:33:10.587532 "35:1196800053:389002" a
2007-12-04 20:33:25.384069 "25:1196800053:389002" c
I would expect the last entry to be first ("25...<"35...) instead
output seems to sorted on k2.
It not due to sort getting confused about the order of keys:
sort -t \t -k 3,3 <test
2007-12-04 20:30:25.384069 "35:1196800053:389002" b
2007-12-04 20:33:10.587532 "35:1196800053:389002" a
2007-12-04 20:33:25.384069 "25:1196800053:389002" c
lowest session id still comes last.
sort --version reports:
sort (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the
terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
I've tried stripping the quotes around the session id to no avail. If
the session id comes in the first column it works OK.
I expect I'm doing something stoopid, but I can't for the life of me
see what.
(yes the seperators are all tabs).
Help!
C.
.
- Follow-Ups:
- Re: Sorting confusion
- From: newsnet
- Re: Sorting confusion
- From: Peter Benie
- Re: Sorting confusion
- Prev by Date: Re: how to search usenet
- Next by Date: Re: Sorting confusion
- Previous by thread: Re: I've been playing around.
- Next by thread: Re: Sorting confusion
- Index(es):
Relevant Pages
|
|