Need to join random number of lines untill close brac match and substitute with one space in unix file . There can be multiple occurence like this in file . One liner awk , sed , perl solution will be more helpful.
Eg :
....
abc_mod #(
.h_res(3),
.s_res(10)
)
u_abc_mod
(
....
....
....
def_mod #(
.lp(4),
.clk(9),
.add(5),
.d(8),
.por(1)
)
u_def_mod
(
....
Need to match pattern equivalent to #( till 1st close brace at starting of line ) followed by one extra new line (can include random number of lines ) and substitute with single space.
Desired Output :
....
abc_mod u_abc_mod
(
...
def_mod u_def_mod
(
...
...
Thanks