[TUHS] non-Posix input files
Chet Ramey via TUHS
tuhs at tuhs.org
Fri Mar 28 22:25:00 AEST 2025
On 3/28/25 3:22 AM, arnold at skeeve.com wrote:
> Chet Ramey via TUHS <tuhs at tuhs.org> wrote:
>
>> It also says "The standard utilities that have such restrictions always
>> specify "text files" in their STDIN or INPUT FILES sections," so you can't
>> avoid it.
>>
>> awk is one such utility (sh is not). This is an application requirement, so
>> awk is required to add a newline at the end of a file that does not have
>> one.
>
> No awk I know of actually does that. Instead, they all treat end of file
> as terminating the current input record:
Sorry, I should have been more clear. This requirement is for scripts:
"The requirement that awk add a trailing <newline> to the program argument
text is to simplify the grammar, making it match a text file in form."
which I imagine all awk implementations do.
I think awk does the reasonable thing with an input file that doesn't end
in a newline.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet at case.edu http://tiswww.cwru.edu/~chet/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250328/e9618059/attachment-0001.sig>
More information about the TUHS
mailing list