Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm comparing two different kernel versions (one official, one from a manufacturer); there are thousands of file whose only difference is in metadata in the files. The metadata looks like '$:Key: value$'. Is there a set of tools that modify this stuff? What generates this data? Is there any way to do a diff without this polluting it without running the entire source through sed?

An example:

    --- ./drivers/atm/idt77252.h  2010-10-05 14:53:01.787778390 -0400
+++ ../linux-2.6.21.x/drivers/atm/idt77252.h 2010-03-26 03:08:26.000000000 -0400
@@ -1,8 +1,8 @@
- * ident "$Id: idt77252.h,v 1.2 2001/11/11 08:13:54 ecd Exp $"
+ * ident "$Id: idt77252.h,v 2007-05-25 06:50:05 bruce Exp $"
- * $Author: ecd $
- * $Date: 2001/11/11 08:13:54 $
+ * $Author: bruce $
+ * $Date: 2007-05-25 06:50:05 $
  * Copyright (c) 2000 ATecoM GmbH
share|improve this question
up vote 4 down vote accepted

As Tante says, those $Word: ...$ are inserted and updated by some version control systems (CVS and SubVersion, tipically).

GNU diff has an option --ignore-lines-matching-re that can exclude lines that match a certain regular expression. This one should do the trick:

diff -wu --ignore-matching-lines='\$[A-Z][a-z]*:.*\$' -r sourceA/ sourceB/

(Note the \ before $ to prevent it being interpreted as an end-of-line marker in the regexp.)

share|improve this answer

CVS (a Versioning System) is able to replace certain "Placeholders" with their values upon checkout (so you have for example the version of the checkout or the author in the file).

share|improve this answer

I seem to remember bitkeeper also did this "expand keywords on checkout" dance, by the dates cited this might explain the differences (but only if it is for truly ancient kernel sources). After the bitkeeper fiasco, the sources whene checked into git, which doesn't believe in keyword expansion, so they would get frozen at that point in time.

Can we know what kernel sources you are comparing? Just curious.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.