[Cialug] Diff that ignores certain things

Todd Walton tdwalton at gmail.com
Mon May 1 18:03:51 UTC 2023


I often diff two config files that should differ only by one small thing.
Like, I might have similar config files for two servers, but one is dev and
one is prod. So the line for database host, for example, would be:

     database_host = "database-dev-1.example.com"

In prod, of course, that will be just the same except "dev" will be "prod".
I'd like to tell diff to consider "dev" and "prod" to be the same, for diff
purposes. Maybe like this:

     diff --consider-identical "/dev/prod/" file1.txt file2.txt

Or:

     diff --replace "/dev/env/" --replace "/prod/env/" file1.txt file2.txt

--
Todd


More information about the Cialug mailing list