wagne...@seas.upenn.edu wrote: > If a file has no newline at the end of the last line, the last line > doesn't get counted.
Thanks for the report. However that is the way it is supposed to work. The 'wc -l' command counts the number of newline characters in the file. It can't count missing newlines as being there. If it did that would break other applications that rely upon an accurate count. This is the way 'wc' has always behaved for 30 years and counting. The standards document how wc should behave here: http://www.opengroup.org/onlinepubs/9699919799/utilities/wc.html -l Write to the standard output the number of <newline> characters in each input file. > But as an edge case, this one is actually slightly less likely to make > people mad! I could almost see an argument for "0" being the right > answer here; nevertheless, the first example seems clearly wrong to me. The problem really comes down to why you would have a "text" file that didn't end with a newline. Is that a text file or is that a binary file? Shouldn't all text files end with a newline character because newlines terminate text file lines? Not ending in a newline tells me that this is not a text file. And if it is not a text file then obviously wc can't modify the count of newline characters in the file. In the end 'wc' can only count what is there exactly and can't make interpretations of it. Bob _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils