[Cialug] Diff that ignores certain things

Jeffrey Ollie jeff at ocjtech.us
Mon May 1 18:12:44 UTC 2023


Dunno if this would work, but difftastic[1] is on my short list of tools to
check out soon. Otherwise you could replace "dev" with "prod" (for example)
in one file and diff the result. Or do an end run around the whole thing
and use templates to generate the config files in the first place. That way
the only possible differences are the changes inserted by the template.

[1] https://github.com/Wilfred/difftastic

On Mon, May 1, 2023 at 1:04 PM Todd Walton <tdwalton at gmail.com> wrote:

> 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
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> https://www.cialug.org/cgi-bin/mailman/listinfo/cialug
>


-- 
Jeff Ollie
The majestik møøse is one of the mäni interesting furry animals in Sweden.


More information about the Cialug mailing list