🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #958

nl(1) defect or feature?

#958
From: Wayne Krone
Date: Wed, 18 Jan 1989 01:41
18 lines
1017 bytes
The command nl(1) numbers the lines of the input text.  You can limit
the lines numbered to those matching the regular expression "pattern"
by using the option "-bppattern" (among others).  While doing some
other work on nl(1), I noticed when it processes a text line it passes
the text plus the trailing newline to the regular expression routine.
This means the line:

abc

must be matched by the RE "abc\n$" instead of "abc$".  Other commands
strip off the newline before performing the regular expression match.
It's quite easy to make nl(1) work similar to the other commands, but
I was unsure whether I should fix this as a defect or document it as
a feature.  Any opinions?

Thanks,

Wayne Krone
Technical Details
Message-ID: <3920009@hpirs.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hpda!hpcupt1!hpirs!wk

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hpda!hpcupt1!hpirs!wk
From: wk@hpirs.HP.COM (Wayne Krone)
Newsgroups: comp.bugs.sys5
Subject: nl(1) defect or feature?
Message-ID: <3920009@hpirs.HP.COM>
Date: 18 Jan 89 01:41:14 GMT
Organization: Hewlett Packard, Cupertino
Lines: 18