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