- publishing free software manuals
Comparing and Merging Files with GNU diff and patch
by David MacKenzie, Paul Eggert, and Richard Stallman
Paperback (6"x9"), 120 pages
ISBN 0954161750
RRP £12.95 ($19.95)

"Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>>

1.5 Suppressing Lines Matching a Regular Expression

To ignore insertions and deletions of lines that match a grep-style regular expression, use the -I regexp or --ignore-matching-lines=regexp option. You should escape regular expressions that contain shell metacharacters to prevent the shell from expanding them. For example, ‘diff -I '^[[:digit:]]'’ ignores all changes to lines beginning with a digit.

However, -I only ignores the insertion or deletion of lines that contain the regular expression if every changed line in the hunk--every insertion and every deletion--matches the regular expression. In other words, for each nonignorable change, diff prints the complete set of changes in its vicinity, including the ignorable ones.

You can specify more than one regular expression for lines to ignore by using more than one -I option. diff tries to match each line against each regular expression.

ISBN 0954161750Comparing and Merging Files with GNU diff and patchSee the print edition