i want use sed replace ip addresses in below entry.
1500.arp1.akaarp.net.00000000.7ac112c6.123456.6 30 in txt "198.18.193.23,2509.417\;198.18.193.25,2609.417\;198.18.193.27,2709.417"   1500.arp1.akaarp.net.00000000.7ac112c6.123456.6 30 in txt "19.18.19.27,1110.400\;198.18.193.25,2609.417\;198.18.193.27,2709.417"
i tried following :
sed -i s/"198.18.193.23,2409.417\;198.18.193.25,2609.417\;198.18.193.27,2709.417"/"198.18.19.27,1110.400"/ filename.txt
the above entry works if there 1 ip address in actual entry. if there multiple ip addresses separated regular expressions doesn't work.
your question extremely unclear if want replace whatever list of ip addresses between quotes that's just:
$ sed 's/"[^"]*"/"198.18.19.27,1110.400"/' file 1500.arp1.akaarp.net.00000000.7ac112c6.123456.6 30 in txt "198.18.19.27,1110.400"   if that's not want edit question clarify requirements. in particular explain these 2 sentences in question mean:
- the above entry works if there 1 ip address in actual entry.
 - if there multiple ip addresses separated regular expressions doesn't work.
 
the above run on input file:
$ cat file 1500.arp1.akaarp.net.00000000.7ac112c6.123456.6 30 in txt "198.18.193.23,2509.417\;198.18.193.25,2609.417\;198.18.193.27,2709.417"      
Comments
Post a Comment