bug-diffutils
[Top][All Lists]
Advanced

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

[bug-diffutils] bug#18076: bug#18076: Lines are not ignored by option -I


From: Eric Blake
Subject: [bug-diffutils] bug#18076: bug#18076: Lines are not ignored by option -I if they are followed by a line with a difference
Date: Tue, 22 Jul 2014 10:58:58 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

tag 18076 notabug
thanks

On 07/22/2014 12:59 AM, Jean-Francois Thuong wrote:

> To reproduce:
> 1. Create 2 files (e.g. File1.txt and File2.txt) having 2 consecutive
> different lines (e.g. lines 2 and 3)
> 2. Run diff with option -I including a pattern matching line 2
> 3. Observe that diff returns differences for both lines 2 and 3

Thanks for the report.  However, this is not a bug, but documented
behavior.  -I only suppresses entire hunks where EVERY difference in the
hunk matches the regex.

The mode of operation you are requesting, where diff ignores lines that
match the regex prior to doing the comparison (although line numbers are
then a bit off), can be accomplished via this trick in bash:

patt='^IGNORE:'
diff <(sed "/$patt/d" File1.txt) <(sed "/$patt/d" File2.txt)

Maybe it's worth a new option to diff to allow this mode of operation by
default (and so that line numbers are still accurate); but -I cannot be
changed semantics to match that new option.

I'm closing this report as we are matching our documentation, although
we can reopen it if someone is interested in writing a patch for such a
new option.

> *The information transmitted is intended only for the person or entity to

Sorry, but such disclaimers are unenforceable on publicly-archived
mailing lists.  You may want to consider sending from a personal account
in the future, rather than slamming the list with your employer's
legalese spam.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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