bug-textutils
[Top][All Lists]
Advanced

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

Re: wc reallines patch


From: Ulf Harnhammar
Subject: Re: wc reallines patch
Date: Mon, 3 Feb 2003 13:32:31 +0100 (CET)

On Sun, 2 Feb 2003, Jim Meyering wrote:

> > Have you had the time to look at my wc reallines patch?
> 
> Thanks for the patch.  I'm not sure it's worthwhile,
> but am willing to be convinced.  Making your argument in
> the form of examples (diffs to coreutils.texi) demonstrating
> the usefulness of the new option would help.

The current wc doesn't really count the number of lines in a file. It
counts LF characters.

If we have this example file..

test1<LF>test2<LF>test3<LF>

..wc -l will say that it has 3 LF characters. However, if we have this
example file..

test1<LF>test2<LF>test3

..wc -l will say that it has 2 LF characters. This is correct, but not
very useful to the user who wants to know how many lines that the file
consists of.

Several editors, including GNU Emacs and some editors on the Windows
platform, are known to produce this kind of file without an <LF> at the
end.

My patch therefore adds the new -i (--reallines) option, which counts the
actual number of lines in a file. wc -i on the second example file above
would give the output 3.

I think this would be a worthwhile addition to wc, and I have seen in the
bug-textutils archives that a couple of others have asked about this,
indicating that they too would be interested in this.

If I have convinced you, I will produce a patch against the alpha version
of coreutils. I'm unfortunately not familiar with TeX, but I can try to
add some information in the manual as well.

// Ulf Harnhammar





reply via email to

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