[comp.bugs.sys5] nl

wk@hpirs.HP.COM (Wayne Krone) (01/18/89)

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