Hi
I am setting the variables like this :
setenv MODULE1 modem5__3
setenv MODULE2 modem5__2
setenv MODULE3 modem_ctrl_1_1
setenv MODULE4 modem_1_0
setenv COUNT 10
I am having a bash script as shown below
################################################
#!/bin/bash
for (( c=1; c<=${COUNT}; c++ ))
do
sed -n '/module '${MODULE}'${c} /,/endmodule/p' prescan.v > temp${c}.v
sed -i '0,/o_func_clk /s/o_func_clk/o_func_clk, DFT_ClkEnScanIn1 ,scan_clock_en , DFT_ClkgenScanEnable /' temp${c}.v
#sed -i '0,/i_UDR_DFT_free_running;/i_UDR_DFT_free_running;/i_UDR_DFT_free_running , DFT_ClkEnScanIn1 , DFT_ClkgenScanEnable ;/' temp${c}.v
sed -i 's/i_UDR_DFT_free_running;/i_UDR_DFT_free_running , DFT_ClkEnScanIn1 , DFT_ClkgenScanEnable ;/' temp${c}.v
sed -i '/\[0\:0\] i_func_clk_en/a output scan_clock_en ;' temp${c}.v
sed -i '/scan_clock_en_reg/,+1d' temp${c}.v
sed -i '/endmodule/i M8E35B_SDFF2X1 scan_clock_en_reg (.q ( scan_clock_en ) , .d (pre_scan_clock_en ) , .te ( DFT_ClkgenScanEnable ) , .ti ( DFT_ClkEnScanIn1 ) , .phi ( i_scan_clk ));' temp${c}.v
done
This script should generate multiple temp files temp1.v temp2.v temp3.v temp4.v
after being processed with sed scripts.
The problem is with the first line
sed -n '/module '${MODULE}'${c} /,/endmodule/p' prescan.v > temp${c}.v
sed is unable to do variable substitution.
I tried with double quotes also substitution is not happening and getting empty temp files.
The $c should be incremented and the $MODULE1 $MODUL2 should be read depending upon the environmental variable set and the pattern should be searched and temp file should be created.
Please let me how to tackle this issue