I want to append some code after a verilog port list, which has the form:
module module_name (
input wire in1,
input wire in2,
output wire out1
);
I'm looking for help on how to use sed (or another command) to find the port list starting with "module" and ending with ");" and then append some code on the line following ");"
The command:
sed '/^module/,/);/a code to append' test.v
puts "code to append" on every line within the matched sequence and not only after it
module module_name (
code to append
input wire in1,
code to append
input wire in2,
code to append
output wire out1
code to append
);
code to append
This might work for you:
sed '/^module/,/);/!b;/);/a\NEWCODE' file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With