Since lineinfile only check the first or last match, is there a way I can use it to edit my file as I wanted on all matches?
Example : I have a file like the one below and I want to add ZZZ after all AAA matches.
Source file:
AAA
BBB
AAA
CCC
DDD
Desired output :
AAA
ZZZ
BBB
AAA
ZZZ
CCC
DDD
I tried the module replace, but since it has to match a regex, I don't really know how I can write it either.