The situation: The first file is a device configuration file, the second is a file that has just one section of the device's configuration. My users will be able to edit the second file (with just the partial config), which I will then need to be able to apply to the first file. Since this is a config file for a device, I can't put anything like marker symbols into the config, since the device won't accept them. Also, in the long term, I'd like to be able to take the configuration section from the user and apply it to multiple device configuration files, which is why I'm looking for something automated.
I've looked at Text::Diff and Algorithm::Diff, but since the line numbers (and total content) will be different between the two files, it doesn't look like either one of those will work. I thought about making a fake file from the main config file containing just the lines that match & then using Text::Diff, but then I'm faced with the problem of finding the matching lines, by which point I will have basically re-written Diff.
Do any of you have any ideas to make this simple and/or elegant? I can do brute force & ignorance, but I was hoping to avoid that approach.
Thanks much.
In reply to Making a Diff from a partial change by gclef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |