I want to insert "123" below madguy-xyz- line in "module xyz". There are multiple modules having similar lines. But i want to add it in only "module xyz".
module abc
njkenjkfvsfd
madguy-xyz-mafdvnskjfvn
enfvjkesn
endmodule
module xyz
njkenjkfvsfd
madguy-xyz-mafdvnskjfvn
enfvjkesn
endmodule
This is the code i tried but doesn't work,
sed -i "/module xyz/,/^endmodule/{/madguy-xyz-/a 123}" <file_name>
This is the error I got: sed: -e expression #1, char 0: unmatched `{'