[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in 'wc -l'
From: |
Alfred M. Szmidt |
Subject: |
Re: bug in 'wc -l' |
Date: |
Fri, 6 Feb 2004 16:35:29 +0100 (MET) |
> I am sending you a patch to solve a 'problem' at the wc
> program. When used with -l option (to count the number of
> lines) the last line isn't counted.
> It counts occurences of '\n' (i.e. newline). So I guess that
> the behaviour is correct.
If that's your definition of a line, obviously. However, the poster
is probably right that the last line of a file should count as a
line even if it lacks a final newline.
I was quoting the manual; `wc -l' counts how many times it hits a
`newline' (\n). Not `lines' per see (since that is hard to define
exactly).
,----[ (coreutils)wc invocation ]
| `-l'
| `--lines'
| Print only the newline counts.
`----
Cheers!