Shell quoting problem while editing a remote file using sed

view full story

http://www.unix.com – value of i = solarisbox Code: ssh $i "cat /etc/hosts | sed "s/$i\.local\.//" | sed "s/$i\./$i/" | sed "s/$i/$i.sol.com/" > /usr/users/chidori/edit_hosts" While running the above one liner its i am not able to make the changes and write it to the file /usr/users/chidori/edit_hosts . I know there is a quoting problem. Please help in fixing it. Input: Code: # cat /etc/hosts # # Internet host table # ::1    localhost      localhost  solarisbox solarisbox.local. solarisbox.  loghost loghos (HowTos)