Hello,
I am writing a script [1] which is not giving the desired result. When I check the content of the 'InputFile_009_0.sh'[2], it shows following with missing Index in this command
sed -i "s/L1ITMBLT.root/L1ITMBLT_"".root/g" run_DttfFromCombinedPrimitives_cfg.py
of [2].
Any help?
[1]
#!/bin/sh
CONFIGFILE=run_DttfFromCombinedPrimitives_cfg.py
for FILE in *txt
do
echo $FILE
ScriptName=$(echo $FILE | awk '{split($FILE, a, ".txt"); print a[1]}')
cat > $ScriptName.sh <<EOF
#!/bin/sh
sed -i "s/InputFile[a-zA-Z0-9]*/${FILE}/g" $CONFIGFILE
Index=$(echo $FILE | awk '{match($0,/\_.*\_/);print substr($0,RSTART,RLENGTH+1)}')
echo $Index
sed -i "s/L1ITMBLT.root/L1ITMBLT_"${Index}".root/g" $CONFIGFILE
#cmsRun $CONFIGFILE
EOF
done
-------------------------------------------------------------------------
where FILE in the directory is:
InputFile_009_0.txt
InputFile_009_1.txt
InputFile_009_2.txt
InputFile_009_3.txt
InputFile_009_4.txt
[2]
#!/bin/sh
sed -i "s/InputFile[a-zA-Z0-9]*/InputFile_009_0.txt/g" run_DttfFromCombinedPrimitives_cfg.py
Index=_009_0
sed -i "s/L1ITMBLT.root/L1ITMBLT_"".root/g" run_DttfFromCombinedPrimitives_cfg.py
#cmsRun run_DttfFromCombinedPrimitives_cfg.py