Text File / Line

コメントから

Unix においてテキストファイルとは行の集合であり、行とは改行文字で終わるものと定義される、とどこかで読んだ記憶があります。

ふむ。きむらさんのところから(関係ないけどエントリに対する Permalink がおかしい。日付についているリンクはいいんだけど)

今、再度調べてみたけど見つからなかったんですが、 POSIX的には「テキストファイル」の定義ってのは決まってまして、 それによると各行の末尾は必ず改行を含むことになっています。 ですから、「テキストファイル」を扱うと謳っているユーティリティが ファイル末尾に改行を含まないファイルに対して文句つけても、 POSIX的には間違ってないです。
あと行の長さとして最低限これだけの長さは許容しなければいけないとかも あったんですけど、どこだっけなー。 あ、英語だったのは間違いないです。

POSIX だというならまんま POSIX を見ればいいんじゃないでしょうか。ということで見てみた。

A file that contains characters organized into one or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the . Although IEEE Std 1003.1-2001 does not distinguish between text files and binary files (see the ISO C standard), many utilities only produce predictable or meaningful output when operating on text files. The standard utilities that have such restrictions always specify "text files" in their STDIN or INPUT FILES sections.

A sequence of zero or more non- <newline>s plus a terminating <newline>.

ということで POSIX 的に行は改行で終了していて、テキストファイルは行の集合だからファイル末尾には必ず改行が来ると。id:parasporospa さん、きむらさんの言うとおりですね。
あとテキストファイルなら1行の長さが LINE_MAX を超えてはならないとか。

% getconf LINE_MAX
2048

案外少ないな。