[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
undocumented nl behavior with -bt
From: |
paul |
Subject: |
undocumented nl behavior with -bt |
Date: |
Thu, 6 Mar 2008 09:31:59 -0600 |
User-agent: |
KMail/1.9.9 |
re: nl (GNU coreutils) 6.9 Fedora 7 Linux
Good morning--
I have not used nl for a long time but just found a use for it. It does the
numbering that I want but it does more than that. The file I am numbering is
many lines of text with interspersed blank lines. (It is data exported from
an accounting system that is input to a perl program.) The blank lines would
be more accurately be called empty or null lines as they do not contain any
white space characters, simply consecutive new line characters in the data
file. The perl program recognizes these empty lines and handles them as
required by its specifications.
After numbering the lines using: nl -s, -w1 -nln oldfile > newfile
the perl program now chokes on the once empty lines in newfile. Upon
examination I find that the empty lines are no longer empty. They now
contain a number of space characters equal to the setting of the -w option.
They cannot be suppressed entirely by specifying -w0 as that is reported as
an invalid value, which is reasonable considering the purpose of -w.
The man page (and info page) states that the t style is to "number only
nonempty lines". This it does but it also changes the nonempty lines into
lines containing spaces. I feel that this latter behavior should not be
included in nl.
Since nl has been around for many years there may be some users taking
advantage of this undocumented behavior. Therefore I propose that an option
be added to allow the user to suppress this historical behavior. In other
words the option would direct nl to leave empty lines empty. I suggest the
option be "-e". An alternative would be to specify this with a new body
numbering style instead of an option.
Thank you for your consideration of this matter.
paul
ps--Mac OS X version of nl has the same behavior and worse. If the -s option
is present it inserts the separator character into the empty line following
the string of spaces. I have no other Unix platforms available on which to
try nl.
--
Paul Almquist
Eau Claire, WI USA
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- undocumented nl behavior with -bt,
paul <=