nl(1) defect or feature?

Wayne Krone wk at hpirs.HP.COM
Wed Jan 18 11:41:14 AEST 1989


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



More information about the Comp.bugs.sys5 mailing list