[Top][All Lists]

[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: Tue, 4 Feb 2003 03:20:24 +0100 (CET)

On Mon, 3 Feb 2003, Bob Proulx wrote:

> Aren't lines defined by newline characters?  Isn't a file that is
> missing a newline really missing a line, that is, that last line is
> only half constructed?  A partial line?

Lines in a file are definitely separated by some kind of newline marker
(LF, CRLF, CR), but I'm not sure if I agree that a line has to end with

> I realize that sometimes there is nothing else to end a sentence with.
> But those last characters in the file before the file stops seem to be
> dangling.  I am not really sure if I am just reading the file in the
> process of being written.  Will more characters appear later and
> finish things off?  Did the process writing that line get killed
> before it could finish the job?

These problems could well appear from time to time, but I would guess that
files having been saved in the editors that I mentioned are more common.

> I object to the wording "reallines" primarily because that last line
> getting added to the count is not really a line but is just getting
> faked out as one.  It would be better to call it "fakelines" instead.
> Perhaps a better word would be counting it as a partial line.
> Therefore adding '--partial-lines' would count any part of a line.

OK, reallines is perhaps a bit too subjective. partial-lines sounds good
to me too.

Perhaps I should note that the people who wrote about this issue in the
bug-textutils archives reported it as a bug in the -l option. They
expected it to count partial lines too. I wouldn't go that far. The -l
option follows the POSIX standard, and there are probably lots of scripts
out there that depend on it. Adding an option for this is to me the best
solution, especially as wc doesn't have quite as many options as ls does.

// Ulf Harnhammar

reply via email to

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