problem with sed n variable in shell script
i have a problem in using sed .. awk is very complicated for me .. my task is a simple stuff .. i have to create a script in which i have to take three input
3> second word
in this script i have to just replace every instance of first word by second word in file supplied
here is my silly script
ls $1 > /dev/null
if [ $? -eq 1 ]
echo file not found
cat $1 | sed 's/$2/$3/g'
when i supply constant string instead of variable .. its doing my work .. like if i give
instead of $2 and $3 like
its replacing dipen by ass .. in the file ..
so again i m stuck by not able to expand my variable ..
i tried everything .. somethings i tried were
sed 's/`echo $2`/`echo $2`/g'
i have tried using escape sequence almost everywhere ..
thnks in advance