The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-20-2008
tuathan tuathan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 10
Is it possible to replace more the 1 string with one SED?

i want to replace two phrases in text file

originalstringA.1.
blah blah....
originalstringB.1.

got this code so far:

#variables
IP=$1
NO=$2
FS=$3
IS=$4
NN=1
#echo variables
echo ''
echo $IP
echo $NO
echo $FS
echo $IS
echo '****'
echo $NN
#generate files and configure
while [ $NN -le $NO ]
do
cp template.egsinp $IP.$NN.egsinp
sed s/template/$IP.$NN/ <template.egsinp > $IP.$NN.egsinp
#i need something else here that replaces something else and has the same input/output files as the above sed.
echo '****'
NN=$(($NN + 1))
echo $NN
done
#exit
exit