bug-textutils
[Top][All Lists]
Advanced

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

Re: WC command


From: Jim Meyering
Subject: Re: WC command
Date: 14 Apr 2001 08:42:33 +0200
User-agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/21.0.103

"Sowmya Nanjundaiah" <address@hidden> wrote:
|  I have files which have been FTPd from DOS to Linux.  When I use the
| command wc -l on them it gives line count which is less than what is
| actual.  If  I give nl command it gives proper number of lines.  If  I
| insert a newline at the end of the file, save it and delete it and save
| it, and then try wc -l command it gives the exact count.

Thanks for the report.
However, `wc -l' counts newlines by definition, and if your
file doesn't end with a newline, then the number reported by
wc will be one less than the number of lines.

  $ wc --help
  Usage: wc [OPTION]... [FILE]...
  Print line, word, and byte counts for each FILE, and a total line if
  more than one FILE is specified.  With no FILE, or when FILE is -,
  read standard input.
    -c, --bytes            print the byte counts
    -m, --chars            print the character counts
    -l, --lines            print the newline counts
    ...

I just noticed that the above is misleading: the first sentence says that wc
counts lines.  I've just changed the --help output: s/line,/newline,/



reply via email to

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