1837154 Members
2138 Online
110112 Solutions
New Discussion

sed help

 
SOLVED
Go to solution
sdip
Advisor

sed help

Hi,

I have defined following variables.
TST="10.220.10.1 11.11.11.1"
TST1=`echo $TST 12.12.12.12`
Now I want to replace that TST variable with TST1. When I am giving following command it is not replacing my expected one.

echo "$TST" | sed "s/'$TST'/'$TST1'/g" ./ss

Could anyone please advise me how I can replace that string with TST1 variable.

Thnkx
2 REPLIES 2
Biswajit Tripathy
Honored Contributor
Solution

Re: sed help

Use:
echo "$TST" | sed "s/$TST/$TST1/g" > ./ss

- Biswajit
:-)
Robert Salter
Respected Contributor

Re: sed help


echo "$TST" |sed "s/^.*$/$TST1/g" > file

or TST=$TST1
Time to smoke and joke