From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 28662 invoked from network); 10 Mar 2020 16:16:01 -0000 Received-SPF: pass (minnie.tuhs.org: domain of minnie.tuhs.org designates 45.79.103.53 as permitted sender) receiver=inbox.vuxu.org; client-ip=45.79.103.53 envelope-from= Received: from unknown (HELO minnie.tuhs.org) (45.79.103.53) by inbox.vuxu.org with ESMTP; 10 Mar 2020 16:16:01 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 8BFC793D70; Wed, 11 Mar 2020 02:15:56 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 5E9BA93D29; Wed, 11 Mar 2020 02:15:27 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id CED3293D29; Wed, 11 Mar 2020 02:15:24 +1000 (AEST) Received: from mail.cs.dartmouth.edu (mail.cs.dartmouth.edu [129.170.212.100]) by minnie.tuhs.org (Postfix) with ESMTPS id 274B493D06 for ; Wed, 11 Mar 2020 02:15:24 +1000 (AEST) Received: from coolidge.cs.dartmouth.edu (coolidge.cs.dartmouth.edu [129.170.213.217]) by mail.cs.dartmouth.edu (8.15.2/8.15.2) with ESMTPS id 02AGFLl52580647 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Tue, 10 Mar 2020 12:15:21 -0400 Received: from coolidge.cs.dartmouth.edu (localhost [127.0.0.1]) by coolidge.cs.dartmouth.edu (8.15.2/8.15.2) with ESMTP id 02AGFLFG075921 for ; Tue, 10 Mar 2020 12:15:21 -0400 Received: (from doug@localhost) by coolidge.cs.dartmouth.edu (8.15.2/8.15.2/Submit) id 02AGFLgS075920 for tuhs@tuhs.org; Tue, 10 Mar 2020 12:15:21 -0400 From: Doug McIlroy Message-Id: <202003101615.02AGFLgS075920@coolidge.cs.dartmouth.edu> Date: Tue, 10 Mar 2020 12:15:21 -0400 To: tuhs@tuhs.org User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [TUHS] Command line options and complexity X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" > The idea of a simple rule is great, but the suggested rule fails on sort -u > which afaik came after sort | uniq for performance reasons. As the guilty party for most of sort's comparison options, I can attest that efficiency was not an objective of -u. It was invented precisely because uniq had proved useful, but not when one was interested in uniqueness only of some key aspect of the data. -u differs from uniq in that -u selects samples based on equality of keys, not equality of lines. In the default case of whole-line keys, sort -u of course does exactly what sort|uniq does. For many applications of -u with keys, the non-key fields are not of interest. Then sed s/nonkeys//|sort|uniq may suffice. But sed did not exist when -u was invented. And not all sort key specs are easily imitated in sed. Doug