This is really just a pet peeve, since it's not a problem, but...

The "nl" command doesn't number empty lines by default. Is that kind of weird to anyone else?

We can work around this with:
nl -b a <file>

I'm just wondering why:
nl -b t <file>
is the default setting?

Isn't the POSIX definition of a line "something that ends with a newline character"?
pubs.opengroup.org/onlinepubs/

So shouldn't "Number Lines" mean "Number *all* lines" *unless* you tell it not to"?

And by "empty line" I mean "A line with 0 characters followed by a terminating newline character".

A line with nothing on it but a newline character is still a line.

Follow

@MutoShack It's not what I'd expect naïvely, but thinking about it, skipping blank lines is probably more useful. Bring able to pipe a command's output to another's input was pretty important in old-style Unix. Since many programs treat empty lines specially, the default setting is good if you want downstream programs to act correctly.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.