maverh at telenet.be
2012-Jun-19 05:30 UTC
[CentOS] replace string with sed but not the first one
Hi, ? We have a the following file [ip-map] # Unchanged IP addresses: # Please review default IP addresses mapping below: 192.168.1.10?shared??? ->????? 192.168.123.6 shared [namexx] 192.168.1.10 naam?? 192.168.1.10 We want to replace 192.168.1.10? to a other string but i don't want to change te first one. ?
----- Original Message ----- From: "maverh at telenet.be" <maverh at telenet.be> To: centos at centos.org Cc: Sent: Monday, June 18, 2012 10:30 PM Subject: [CentOS] replace string with sed but not the first one Hi, ? We have a the following file [ip-map] # Unchanged IP addresses: # Please review default IP addresses mapping below: 192.168.1.10?shared??? ->????? 192.168.123.6 shared [namexx] 192.168.1.10 naam?? 192.168.1.10 We want to replace 192.168.1.10? to a other string but i don't want to change te first one. ----------- cat >> cml.txt<<EOL [ip-map] # Unchanged IP addresses: # Please review default IP addresses mapping below: 192.168.1.10?shared??? ->????? 192.168.123.6 shared [namexx] 192.168.1.10 naam?? 192.168.1.10 EOL sed -i -e 's/192.168.1.10$/192.168.1.11/g' cml.txt -- Mark