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

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

How to exclude certain hunk types (added, changed, deleted) from diff


From: Alexander Kriegisch
Subject: How to exclude certain hunk types (added, changed, deleted) from diff
Date: Wed, 26 Sep 2007 14:05:55 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

* Atention, this is not a bug report but a question not answered by the
manual. If there is an official discussion mailing list for this type of
inquiry, I beg your pardon and kindly ask you to point me to that list
or forum. *

I have a special case here in which I am getting huge diff outputs, but
am interested only in deleted and changed hunks, not added hunks.
Unfortunately, the latter make up >90% of my diff, resulting in the
interesting parts being hard to find.

I experimented with something like

diff
  --new-group-format='' \
  --unchanged-group-format='' \
  --changed-group-format='-%<+%>' \
  file1 file2

, but the output does not look very "diff-like". I tried to find default
format strings for uni-diff in the source code, but there is none, as
the output is produced in a hard-coded way.

Is there a simple way of telling diff to exclude a/d/c hunks from
output, but show the remainder in a uni-diff-like fashion? Filtering a
complete uni-diff with sed or grep is hard, because those tools do not
have a multi-line regex matching mode which would be needed to do it.

Any ideas?
--
Alexander Kriegisch




reply via email to

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