TCL script to insert some text on a file

Hi All ,

I am looking to create one TCL script to insert one text based on some regular expression match on one file as stated below

Input File

module (mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2 , 
ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2 );

output ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2;
input mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;
wire mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;

endmodule 

I have to insert below stated text to the above input file
bist_m_p::mst_in_m_ram_t bist_in
bist_sm_p::bist_out_m_sram_t bist_out

The output file should look like this

Output file

module (mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2 , 
ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2,bist_m_p::mst_in_m_ram_t  bist_in ,bist_sm_p::bist_out_m_sram_t bist_out );

output ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2;bist_m_p::mst_in_m_ram_t  bist_in;
input mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;bist_sm_p::bist_out_m_sram_t bist_out;
wire mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;



endmodule 

Great!

Please show your code you have written and any error messages you received.