I can replace a string by a string using sed
, but how can I replace a string with a number? My code is:
while read x
do
echo $x
sed 's/xx/$x/g' xy.in > x1
cat > x1 >> x2.dat
done < xyz.dat
I want to replace string xx
in xy.in
with the number that I read from file xyz.dat
. But Instead of the number, I am getting blank spaces in x2.dat
.