Saifullah QAZI wrote:
>    
 
> 
>    Hi, using cygwin, 'wc' count is alway one less than actual lines in file= .
>    Is that defect or designed.?
>    

The wc program counts newline characters (0x0a) in the file.

  info coreutils wc

  `wc' counts the number of bytes, characters, whitespace-separated
  words, and newlines in each given FILE, ...

It does not really know anything about lines.  For example, are lines
separated by newlines or terminated by newlines?  That has been a
confusing problem for years.  Counting newlines in files is both
unambiguous and also the traditional legacy behavior standardized by
POSIX.  Changing that would break many things.

If the count from wc of newline characters in the file matches the
number of newline characters in the file then it is correct and
everything is working as expected.  If the count from wc of newline
characters in the file does not match the actual number of newline
characters in the file then it would be a bug.

If you have found a bug then please report as small of a test case as
you can that illustrates the problem.  Plus include the version of the
program.  For example:

  echo | wc -l
  1
  wc --version
  wc (GNU coreutils) 6.2-cvs

Bob


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to