From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25280 invoked from network); 24 Jul 2022 19:03:52 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 24 Jul 2022 19:03:52 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id EB38C4071A; Mon, 25 Jul 2022 05:03:13 +1000 (AEST) Received: from mailout2.ceti.pl (mailout2.ceti.pl [62.121.128.42]) by minnie.tuhs.org (Postfix) with ESMTPS id E7CBA40120 for ; Mon, 25 Jul 2022 05:02:56 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by mailout2.ceti.pl (Postfix) with ESMTP id 818B41ED50 for ; Sun, 24 Jul 2022 21:02:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mailout.ceti.pl Received: from mailout2.ceti.pl ([62.121.128.42]) by localhost (mailout.ceti.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0FGdSVN5nXPL for ; Sun, 24 Jul 2022 21:02:54 +0200 (CEST) Received: from tau1.ceti.pl (tau.ceti.pl [62.121.128.11]) by mailout2.ceti.pl (Postfix) with ESMTP id 3DDA31ECDB for ; Sun, 24 Jul 2022 21:02:54 +0200 (CEST) Received: by tau1.ceti.pl (Postfix, from userid 3727) id 07D09960982; Sun, 24 Jul 2022 21:02:53 +0200 (CEST) Date: Sun, 24 Jul 2022 21:02:53 +0200 From: Tomasz Rola To: The Eunuchs Hysterical Society Message-ID: <20220724190253.GA23421@tau1.ceti.pl> References: <1oF87S-4zW-00@marmaro.de> <8NgHeeJiYEBE0zhtd9RdKIeYWcAwtxsnAj7YhVIvLpz-yt0__LeFvVzNNGgSNTeDGnVQy-qxkoHWvmRi84ybYyNAiMRDJuVoAaEG96UAu4s=@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Message-ID-Hash: EGM26RVZPGU7KT5CG6QUJ35QX6V7P3JO X-Message-ID-Hash: EGM26RVZPGU7KT5CG6QUJ35QX6V7P3JO X-MailFrom: rtomek@tau1.ceti.pl X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: Line Numbers Before SysIII nl? BSD num? List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Sat, Jul 23, 2022 at 08:00:10AM -0400, Dan Cross wrote: > On Sat, Jul 23, 2022 at 7:20 AM John Cowan wrote: [...] > > An obvious approach, which would leave no real traces in documentation, would be: > > > > $ awk '{print NR, $0}' > > > > A more precise emulation would be more of a pain to type: > > > > $ awk '{printf("%6d\t%s\n", NR, $0)}' > > > > but perfectly usable in a script. > > Yes, but awk wasn't widely available until 7th edition. I imagine work > on it began before `num` in 2BSD, but few outside of Bell Labs would > have seen it prior to 1978 or so. > > I wonder if the use-case was just sufficiently rare that no one felt like > building a special tool and it was just done on an ad-hoc basis, if > necessary. My sed-fu is only rudimentary but after banging my head against monitor a bit, I came up with this: $ wc -l c.lisp 90 c.lisp $ cat c.lisp | sed -e '{=;}' | sed -e 'N;s/\n/ /' Seems to print what is needed. Now, just embed it in sh script. A program in C could be longer, and required a compiler. -- Regards, Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home ** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_rola@bigfoot.com **