On Tue, Nov 14, 2023 at 02:34:27PM +0100, Omar Polo wrote: > On 2023/11/14 08:19:11 -0300, Crystal Kolipe <kolip...@exoticsilicon.com> > wrote: > > On Tue, Nov 14, 2023 at 11:43:14AM +0100, Daniele B. wrote: > > > enanching the original tool "num". > > I haven't read the previous linked stuff but > > > /bin/cat already has the -c option to number lines, although it always > > starts > > numbering at 1. > > I guess you meant -n, -c doesn't seem to exist.
Yes, I have no idea where '-c' came from. It's early :-). ECOFFEE :-). But to redeem myself, I have just discovered a bug in cat when using -n: $ echo foo > /tmp/1 $ echo bar > /tmp/2 $ cat -n /tmp/1 /tmp/2 1 foo 1 bar >From the manual, it's implied that the lines should be numbered sequentially and continuously, even across concatenated files. Indeed, the GNU version in coreutils does that: $ gcat -n /tmp/1 /tmp/2 1 foo 2 bar Should we match the GNU behaviour? > One could argue that adding -n in the first place was a mistake (: Quite possibly.