If I have a file:
aaa / new replacement line
AAA / old target line
random line
random line
BBB / old target line
CCC / old target line
In this example there are 4 replacements, so the final file should end up like:
aaa / new replacement line
aaa / new replacement line
random line
random line
aaa / new replacement line
aaa / new replacement line
I have an attempt at an answer below but would like to see your input on this also. Maybe there is a more successful 'vim golf' approach I am unaware of. Maybe I'm just being really dumb and there is a simple command for this.
Basically, the question is this: if I have a line yanked into a register, how do I completely replace searched lines matching 'old target line'?