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 26952 invoked from network); 28 Jul 2022 00:30:52 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 28 Jul 2022 00:30:52 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 0854140712; Thu, 28 Jul 2022 10:30:30 +1000 (AEST) Received: from mailout2.ceti.pl (mailout2.ceti.pl [62.121.128.42]) by minnie.tuhs.org (Postfix) with ESMTPS id 845A2406F5 for ; Thu, 28 Jul 2022 10:30:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by mailout2.ceti.pl (Postfix) with ESMTP id 4DBD113A82 for ; Thu, 28 Jul 2022 02:30:15 +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 6yKGmeTtT_ZM for ; Thu, 28 Jul 2022 02:30:14 +0200 (CEST) Received: from tau1.ceti.pl (tau.ceti.pl [62.121.128.11]) by mailout2.ceti.pl (Postfix) with ESMTP id CB65A13A0F for ; Thu, 28 Jul 2022 02:30:14 +0200 (CEST) Received: by tau1.ceti.pl (Postfix, from userid 3727) id 9A816960982; Thu, 28 Jul 2022 02:30:14 +0200 (CEST) Date: Thu, 28 Jul 2022 02:30:14 +0200 From: Tomasz Rola To: The Eunuchs Hysterical Society Message-ID: <20220728003014.GB6195@tau1.ceti.pl> References: <1oF87S-4zW-00@marmaro.de> <8NgHeeJiYEBE0zhtd9RdKIeYWcAwtxsnAj7YhVIvLpz-yt0__LeFvVzNNGgSNTeDGnVQy-qxkoHWvmRi84ybYyNAiMRDJuVoAaEG96UAu4s=@protonmail.com> <20220724190253.GA23421@tau1.ceti.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220724190253.GA23421@tau1.ceti.pl> User-Agent: Mutt/1.5.21 (2010-09-15) Message-ID-Hash: 4D65EDELVBUJLAQ2TLNL4IOSESWEDKFN X-Message-ID-Hash: 4D65EDELVBUJLAQ2TLNL4IOSESWEDKFN 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 Sun, Jul 24, 2022 at 09:02:53PM +0200, Tomasz Rola wrote: > 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}' [...] > > > $ awk '{printf("%6d\t%s\n", NR, $0)}' [...] > > 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. [...] > $ cat c.lisp | sed -e '{=;}' | sed -e 'N;s/\n/ /' Ok, so maybe this is no longer very interesting subject, but I recalled there was once a language named SNOBOL. Wikipedia says, sed was written around 1974 [1] and about SNOBOL it says, the language was being taught [2] in the late 1960s and early 1970s in universities, so I guess it was quite popular. I wonder if it was ported to Unix early enough to help before sed became available? Anyway, I have got Phil Budne's implementation [3] and after usual drill (configure, make, make install, stow) I could do this: $ snobol4 -b -L ./numlines02.sno < numlines02.sno 1 lnum = 0 2 loop lnum = lnum + 1 3 output = lnum " " input :s(loop) 4 end The first version did not work so well: $ snobol4 -b -L ./numlines01.sno < numlines01.sno | head -8 1 lnum = 0 2 LOOP line = INPUT 3 * Here: detect EOF (how?) and jump to : END 4 lnum = lnum + 1 5 OUTPUT = lnum " " line : S(LOOP) 6 END 7 END 8 END As I already have understood, even after reaching end of input, the INPUT statement keeps returning last line read, counter keeps increasing and last line is being written out for infinity. I have not read any serious docs on SNOBOL yet, so I have no idea how to make the '01' version work, but this is of rather small importance to the list. However, since [2] claims SNOBOL was written in Bell Labs, just like AWK and sed, so perhaps they could be using SNOBOL? [1] https://en.wikipedia.org/wiki/Sed [2] https://en.wikipedia.org/wiki/SNOBOL [3] http://www.regressive.org/snobol4/ -- 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 **