gnu-misc-discuss
[Top][All Lists]
Advanced

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

Re: Diff too difficult


From: Alfred M. Szmidt
Subject: Re: Diff too difficult
Date: Wed, 28 Dec 2005 00:53:30 +0100

   Identical lines were output, but many lines were missing, including
   the </body> and </html> tags. This output isn't easy to read at
   all.

The lines aren't identical, the line-ending is different, they show up
the same on your display though.  diff shows _differences_, which is
why you didn't see any more text, since diff couldn't find any more
differences between the two files.  Just because you don't find the
output easy to read doesn't mean that it is hard to read, read the
diff manual, it explains the format quite well.

   > unified diff's (-u) are nice for source code, side-by-side diff's
   > (-y) are wonderful for text.

   I didn't try that, but I tried sdiff.  The difference between the
   diff with the side-by-side flag and sdiff isn't clear to me.

sdiff is a specialised version of diff for side-by-side output.

   With sdiff, if a line is longer than 2048 characters, it gets cut
   off and there's no way to prevent it. If it's shorter, I think
   there's no text wrapping, so a lot of horizontal scrolling might be
   necessary if you want to provide the full text, which I do.

You are looking at the difference between two files, if those files
have long lines, so will the output, anything else would be silly
since it would give you a false view of what the difference between
the two files are.  If you are looking for a word based difference
program, try wdiff, it is also from the GNU project, and is avaiable
at the usual place.

   Someone suggested that I try diff -u. It also gave me confusing
   output on the same two files:

You haven't explained what is confusing.  It shows three changes, one
line that was replaced by another (one that contains the line-ending
difference), and a single line that was removed.  Both are in two
different hunks (once again see the diff manual for details).

   > The GNU diff manual has a clear description on how to read both
   > these formats, including the default one, and some other formats
   > that I don't remeber.

   Good, then maybe it will be a little easier for me to write a
   script that creates the output that I want, but I still won't be
   happy about having to. Even if I understand the output, I want it
   understood by others without needing more than one or two lines of
   instructions, and without lines being truncated.

diff only truncates lines because you told it to, once again you have
failed to read the documentation for the tool you are trying to use:

  -w NUM  --width=NUM  Output at most NUM (default 130) columns per line.

Really, this is all documented in the manual.  Before you reply to
this message, read the diff manual, please.



reply via email to

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