I attached both picture and *.txt file of a sample work file. In this file Reactions which only start with "r1f", "r2f", "r3f"......and so on. And for each reaction the reaction rates is situated couple of lines later with a "+" sign.
For each reaction rate there are three numbers. I want to change the first And 3rd numbers in reaction rates with +/-75%. For each changes in the file I want to store them in a directory. How can I do it?
Here is a piece of code that i am working with
#!/bin/bash
#usage thisScript inputfile multiplier
inFile=$1
multiplier=$2
outFile=$inFile.$multiplier
grep -Po "^(r[0-9]*f[^ ]*|\+[^\!]*)" Prob01.txt | paste - - > stepOne
function domath {
local theanswer=$(echo $1 $multiplier | awk '{printf "%7.6E\n" , $1*$2}' | sed -E -e 's/[Ee]\+*/E/g' -e 's/^([^-])/+\1/g')
echo $theanswer
}
lines=$(cat stepOne | wc -l)
for ((i=1;i<=$lines;i++)) do
suffix=$(printf "%02d" $i)
line=1
while read c1 c2 c3 c4; do
case $line in
$i) lineOut=$(echo -e "$c1 \t $(domath $c2) $c3 $(domath $c4)")
;;
*) lineOut=$(echo -e "$c1 \t $c2 $c3 $c4")
;;
esac
echo $lineOut >> $outFile.$suffix
line=$((line+1))
done < $inFile
done