Hi ,
I am using the below awk script
awk '{if($0 ~ /B1/) {set=1; next }; if( $0 ~ /END/) {set = 0}; if (set ) { print }}' CODE | awk '/A \(P1\)/{f=1}f && /}/{print; system("cat $1");f=0;next}1' A.lib > newfile
I need to insert code from CODE file into A.lib file
A.lib file content is
A (P1) {
timing : 10;
cap : 2;
slew : 3;
}
C (P2)
time : 10;
cap : 2;
slew : 3;
}
D (P3)
time : 11;
cap : 4;
slew : 6;
}
A (P1) {
time : 16;
cap : 4;
slew : 7;
}
I could able to enter the code from CODE file while searching the patterns A (P1) but it is not inserting the code for another Block
A (P1) {
time : 16;
cap : 4;
slew : 7;
}
My issue is with Global Replacement with this script whereever it can find A (P1) it should insert the code from CODE file .
I tried to use the g operator but it is not working
Please advice in regards with the same
Thanks
Shalini