[TriLUG] `sort` two field text file by second field

Timothy A. Chagnon tchagnon at nc.rr.com
Wed Mar 24 15:31:10 EST 2004


On Wed, 2004-03-24 at 15:23, Jeff Bollinger wrote:
> The man page for 'sort' indicates the ability to use a field separator 
> (-n) but I tried:
> 
> cat filename |sort -rn -t : |more
> 

just add a -k 2 for key field 2

i.e.
cat filename |sort -rn -t : -k 2 |more

-tim
-- 
Timothy A. Chagnon <tchagnon at nc.rr.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20040324/db5bcdac/attachment.pgp>


More information about the TriLUG mailing list