tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [patch] cat -n bug from 33 years ago



>>> Numbering currently starts over at 1 for each input file [...]
>> If you want to have continuing (non-restarting) numbering for
>> multiple input files, one could use "cat file1 file2 | cat -n".
> True, that would be a workaround.

> But shouldn't the current behaviour still be fixed?

First, I think, we should decide whether "fixed" is an appropriate
word.  Perhaps it's just me, but I don't consider Linux cat to be a
reference implementation.  (Indeed, I don't consider the Linux
implementation of pretty much _anything_ to be a reference, except for
Linux-specific things.)

> The restarting for each file has never been mentioned in the manual
> as a feature,

The manual is semi-silent on it.  It's not specifically described, but
-n is documented as numbering "the output lines", which I think
indicates the numbering should continue.

> and it isn't what most people would expect.

I'm not so sure.  Without having seen this thread or the exact wording
in the manpage, I'm not sure which behaviour I would have expected.
(Not that I'm `most people', of course, but, as bad as a sample of
size 1 is, it's better than a sample of size 0.)

There _is_ the point that, with the restarting behaviour, there is a
simple workaround if you want the other behaviour; working around in
the other direction is harder - instead of two cat processes you need
one process per input source, plus one shell (or other overseer) to
reap finished ones and start new ones.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index