Hi! Issue 8 Draft 2.1, XCU, nl, DESCRIPTION says: 100987 The starts of logical page sections shall be signaled by input lines containing nothing but the 100988 following delimiter characters: 100989 Line Start of 100990 \:\:\: Header 100991 \:\: Body 100992 \: Footer 100993 Unless otherwise specified, nl shall assume the text being read is in a single logical page body. and 101057 STDOUT 101058 The standard output shall be a text file in the following format: 101059 "%s%s%s", <line number>, <separator>, <input line> 101060 where <line number> is one of the following numeric formats: 101061 %6d When the rn format is used (the default; see −n). 101062 %06d When the rz format is used. 101063 %−6d When the ln format is used. 101064 <empty> When line numbers are suppressed for a portion of the page; the <separator> is also 101065 suppressed. 101066 In the preceding list, the number 6 is the default width; the −w option can change this value.
Naturally, therefore, one would expect that printf '%s\n' a '\:' b | nl would produce (sans spacing): 1 a \: b (and with -p and \:\:, b ‒ 2 \:\:. 3 b, presumably) Instead, it produces (SysV, illumos, coreutils): 1 a [empty!] b And on NetBSD and its derivatives it produces: 1 1 b The standard is obviously incorrect to not specify how to handle heading lines, and should either add: If the input line signalled the start of a logical page section, an empty line shall be output instead. or If the input line signalled the start of a logical page section, it shall not be written. to STDOUT. Most likely the former because that's the XSI behaviour. Best, наб
signature.asc
Description: PGP signature