bug-coreutils
[Top][All Lists]
Advanced

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

bug#9019: wc -l bug


From: Eric Blake
Subject: bug#9019: wc -l bug
Date: Thu, 07 Jul 2011 10:34:10 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

tag 9019 notabug
thanks

On 07/07/2011 02:31 AM, Andrey Sheyko wrote:
> Hello!
> I've found out that wc -l doen't count the last line if there is no CR in the 
> end of line

Thanks for the report.  However, this is not a bug, but a requirement of
POSIX.  Furthermore, I think you meant NL, not CR.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/wc.html

"-l
    Write to the standard output the number of <newline> characters in
each input file.
...
Early proposals only specified the results when input files were text
files. The current specification more closely matches historical
practice. (Bytes, words, and <newline> characters are counted separately
and the results are written when an end-of-file is detected.)"

A file that does not end in a newline is _not_ a text file, and the
partial data is _not_ counted as a line according to historical practice.

> This message contains confidential information of Scartel, Ltd.

It is considered poor netiquette to send emails to publicly archived
lists with disclaimers like this, since the very nature of public
archival makes this clause unenforceable.  You are better off using a
secondary account that does not add your employer's disclaimer on the end.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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