Hi All,
I am preserving OLD and NEW values and want to replace the values in one go instead of using multiple sed
and mv
commands. Please help.
echo "\nEnter the new qStart time '${CODE}' - (Hit Enter for No Change): \c"
read NEW
echo "\nEnter the new qStop time '${CODE}' - (Hit Enter for No Change): \c"
read NEW1
echo "\nEnter the new tStart time '${CODE}' - (Hit Enter for No Change): \c"
read NEW2
echo "\nEnter the new tStop time '${CODE}' - (Hit Enter for No Change): \c"
read NEW3
After reading the values, doing additional checks and replacing starts at below code. Please suggest how I can do it one go instead of opening the file muultiple times and moving it across.
sed s/'\(.*.exch."${CODE}".qStart.*\)"${CURRENT}"\(.*read\)/\1"${NEW}"\2'/g $LOCK_FILE > $LOCK_FILE.new
mv $LOCK_FILE.new $LOCK_FILE
sed s/'\(.*.exch."${CODE}".qStop.*\)"${CURRENT1}"\(.*read\)/\1"${NEW1}"\2'/g $LOCK_FILE > $LOCK_FILE.new
mv $LOCK_FILE.new $LOCK_FILE
sed s/'\(.*Delay."${CODE}".tStart.*\)"${CURRENT2}"\(.*read\)/\1"${NEW2}"\2'/g $LOCK_FILE > $LOCK_FILE.new
mv $LOCK_FILE.new $LOCK_FILE
sed s/'\(.*Delay."${CODE}".tStop.*\)"${CURRENT3}"\(.*read\)/\1"${NEW3}"\2'/g $LOCK_FILE > $LOCK_FILE.new
mv $LOCK_FILE.new $LOCK_FILE