I have a file with thousands of lines and columns, two of the columns are IP1 and IP2. IP1 is always the same 192.168.100.1
*example.com,192.168.100.1,10.10.1.1,,5effd70e9d99b1acf,10,63,58,42,0,21,84055280,0 example2.com,192.168.100.1,10.10.1.50,,255b2l429c8f23ee,10,63,37,42,1,21,1451066297,0 example3.com,192.168.100.1,10.10.1.58,,589b7a5f8677b,11,68,37,42,1,20,1451066297,0
.............*
I want to replace the value of IP1 with value of IP2, and delete the value of IP2.
I tried this:
sed -i 's/192\.168\.100\.1/$(grep 192\.168\.100\.1 file | awk -F',' '{print $2}')/' file
The following error occured: sed: -e expression #1, char 68: unterminated `s' command
Please help.