On 3/28/25 3:22 AM, arnold(a)skeeve.com wrote:
Chet Ramey via TUHS <tuhs(a)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(a)case.edu
http://tiswww.cwru.edu/~chet/