[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wc -l doesn't count partial lines

From: wagnerdm
Subject: wc -l doesn't count partial lines
Date: Sun, 25 Jan 2009 11:15:26 -0500
User-agent: Internet Messaging Program (IMP) H3 (4.1.3)

If a file has no newline at the end of the last line, the last line doesn't get counted. As a minimal test case, try

% echo foo >test && echo -n bar >>test && wc -l test

Actually, you can even see it in a smaller case:

% echo -n foo >test && wc -l test

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]