delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/13/22:01:26

From: pjfarley AT banet DOT net (Peter J. Farley III)
Newsgroups: comp.os.msdos.djgpp
Subject: sort -u problem/question
Date: Tue, 14 Jul 1998 01:42:40 GMT
Message-ID: <35aab37b.8000330@news1.banet.net>
NNTP-Posting-Host: 32.100.113.176
Organization: IBM.NET
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm trying to use the DJGPP port of GNU sort with the "-u" option to
eliminate all but one equal-key record.  However, all I ever get is a
single record output, the first record in the file.

Is this a known problem with the DJGPP port, or am I not using sort
correctly?

TIA for any help or info you can provide.  Sample data and command
follow.

============= sortuniq.tst =============================
field1\tfield2\tfield3 9 field3\tfield4\tfield5\tfield6/9\tfield7
field1\tfield2\tfield3 1 field3\tfield4\tfield5\tfield6/1\tfield7
field1\tfield2\tfield3 2 field3\tfield4\tfield5\tfield6/2\tfield7
field1\tfield2\tfield3 3 field3\tfield4\tfield5\tfield6/3\tfield7
field1\tfield2\tfield3 4 field3\tfield4\tfield5\tfield6/4\tfield7
field1\tfield2\tfield3 5 field3\tfield4\tfield5\tfield6/5\tfield7
field1\tfield2\tfield3 6 field3\tfield4\tfield5\tfield6/6\tfield7
field1\tfield2\tfield3 7 field3\tfield4\tfield5\tfield6/7\tfield7
field1\tfield2\tfield3 8 field3\tfield4\tfield5\tfield6/8\tfield7
field1\tfield2\tfield3 1 field3\tfield4\tfield5\tfield6/1\tfield7
============= sortuniq.tst =============================
[Replace all "\t" with a real tab before using]

Command and sample output used to sort on fields 3 and 6 with -u, tab
specified as field separator:

C:\stest>sort +2 +5 -t \t -u sortuniq.tst
field1  field2  field3 9 field3 field4  field5  field6/9        field7


----------------------------------------------------
Peter J. Farley III (pjfarley AT nospam DOT dorsai DOT org OR
                     pjfarley AT nospam DOT banet DOT net)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019