How to extract string between two regexes passed as variables to awk?

Viewed 96

I'm trying to extract some text in a passage that is between two strings that are being saved in variables. What is wrong with the following way?

input:

module dft ( a, b, c, clk, z, test_si, test_se );

input [7:0] a;

dft_DW_mult_uns_1 mult_31 ( .a(a), .b(b), .product(reg0) );

endmodule

output:

input [7:0] a;

dft_DW_mult_uns_1 mult_31 ( .a(a), .b(b), .product(reg0) );

using the following code:

try="module dft";

awk '/$try/{flag=1; next} /endmodule/{flag=0} flag' dft_syn.v

but it doesn't recognize the $try variable.

1 Answers
Related