I recently had to create black boxes for 28 verilog modules. I could have done it manually, but thought of using some sed scripting, and it sure got done in a flash.
This is the sed command I used.
sed -i".bak" -n -e '/module/p' -e '/output/p' -e '/input/p' bb.v
where bb.v is the blackbox file.
In my case, I had already created copies of my verilog.v file as bb.v, and I then went about editing the bb.v files. One can also perform the copying and editing in a single step as follows
sed -n -e '/module/p' -e '/output/p' -e '/input/p' verilog.v > bb.v
switch is a way of telling sed that the substitution. printing, deletion have to be done in-place