Shell quoting problem while editing a remote file using sed

value of i = solarisbox

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:

# cat /etc/hosts
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
1.1.1.1  solarisbox solarisbox.local. solarisbox.  loghost loghost2

Desired output :

#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
1.1.1.1  solarisbox.sol.com  solarisbox  loghost loghost2

Try (I haven't changed/optimized your substitutions, just used a single sed to do the required job):

ssh "$i" "sed 's/$i\.local\.//
s/$i\./$i/
s/$i/$i.sol.com/
' /etc/hosts > /usr/users/chidori/edit_hosts"

Thanks it works.. but is it possible to achieve it in a single line ?