File A
Apples
Bananas
Clementines
Dates
File B
Apples
Blueberries
Cherries
Dates
I want to diff A and B to generate a patch that when applied to C will change the line Clementines > Cherries
but will ignore the second line (Blueberries/Blackcurrants/whatever).
File C (before patch)
Apples
Blackcurrants
Clementines
Dates
File C (after patch)
Apples
Blackcurrants
Cherries
Dates
Ideally I would like a patch with context, as this sequence is not guaranteed to always appear in the same place in the file. In my mind the context would contain some form of wildcard line after Apples
and before Clementines
.
I am open to manually editing the diff
output if necessary, but if there's a repeatable command for creating a context-based diff with a wildcard in place of a specific regex match that would be great.
I would like to be able to send this patch to a friend who has file C and have them run a patch
command without having to manually edit anything on their end.
How can this be done?
diff
output. Is there a relation between the line numbers in A, B and C? Please edit your question to clarify this.