hi
I am having a file like this
##############################
mod1 ( a(ll) , b(
c), try(o) , oll(ll)
go(oo) , al(ll)
mm(al) , lpo(kka)
kka(oop) );
mod2 ( jj(ll) , c(
kk), try1q(o1) , ofll(lll)
gao(oo1) , ala(llaa)
mmf(adl) , lddpo(kkad)
kkda(oodp) );
##########################################
I want to match the regular expression line mod1 and mod2 in the file and insert a line
#####################
ak(kk) , akjj(ll) , aa(99k)
after the module ending before ));
Output file
mod1 ( a(ll) , b(
c), try(o) , oll(ll)
go(oo) , al(ll)
mm(al) , lpo(kka)
kka(oop) ,ak(kk) , akjj(ll) , aa(99k) );
mod2 ( jj(ll) , c(
kk), try1q(o1) , ofll(lll)
gao(oo1) , ala(llaa)
mmf(adl) , lddpo(kkad)
kkda(oodp) ,ak(kk) , akjj(ll) , aa(99k) );
##############################
I am using below command
sed '/mod1/a ak(kk) , akjj(ll) , aa(99k)' file1
sed '/mod2/a ak(kk) , akjj(ll) , aa(99k)' file1
but it is appending text after match only
Please let me know how it can work