[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug in "sort"
From: |
Eric Blake |
Subject: |
Re: Possible bug in "sort" |
Date: |
Thu, 09 Aug 2007 07:35:00 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Béla Horváth on 8/9/2007 7:18 AM:
> I have a problem with "sort" (I tested it on ubuntu 7.04, on Mac OSX, and on
> AIX too, and they are identical)
Actually, this seems like a misunderstanding on your part as to how sort
works.
>
> I try to sort the attached file. Field separator is <tab>, but in the
> timestamp field between date and time there is a <space>, not a <tab>.
> I have to sort as first key for timestamp (field 3) - "string like", and as
> second key for sequence number, (field 6) - "numeric like".
>
> sort -t\<tab> -k3 ts.txt
That says to use the string from the third field to the end of the line as
the sort key. You probably meant:
sort -t\<tab> -k3,3 ts.txt
which says to use ONLY the third field as the sort key. Likewise for your
other examples.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGuxgE84KuGfSFAYARApoEAKDD8uZzEtR8tT+V9WRxfhxjCsN0iwCfX/Qi
PPRETOxgrLrFuVsZ4b7eS3M=
=0w+4
-----END PGP SIGNATURE-----