bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: diff bug with 2 files nearly identical content


From: Bob Proulx
Subject: Re: diff bug with 2 files nearly identical content
Date: Sat, 17 Jan 2004 09:56:07 -0700
User-agent: Mutt/1.3.28i

Dave wrote:
> Hi.  I found the problem now, misc0.c was not using unix LF text format.
> misc1.c was in unix LF format. I thought diff would ignore LF/CRLF changes?

There just seems something wrong to me that a program designed to
compare files would ignore differences in the files without being told
explicitly to do so.

> can diff be set into a mode which ignores text line endings and forces
> the output to either LF or CRLF format text? I see no mention of
> unix/win32/mac text file support in man or info pages btw.  thanks, dave

Use the -w option to ignore whitespace.  Make sure that in your locale
a CR is a whitespace character with LC_ALL=C or other.  Then diff
would ignore differences which are only the results of white space in
the files.

Personally I would remove the CRs on the fly.  If test1 is a file with
extra CR characters then I would delete those with tr first and pass
the result to diff by a pipe.  Of course I realize this syntax is not
POSIX standard and therefore not always available.

  diff <(tr -d "\015" < test1) test2

Bob




reply via email to

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