Operating on a subset of lines with sed
Today a coworker posed an interesting question to me. Given a BIG-IP configuration file with thousands of records like this… gtm pool /Common/p_example { members { /Common/2001:668:fc78:0:f811:3ef2:fed7:98cc:vs6_2001_668_fc78_0_f811-3ef2-fed7_98cc-80 { order 0 } } monitor /Common/gateway_icmp } …how can we easily replace every colon in the name : with \\:? In short, /Common/2001:668:fc78:0:f811:3ef2:fed7:98cc:vs6_2001_668_fc78_0_f811-3ef2-fed7_98cc-80 needed to become /Common/2001\\:668\\:fc78\\:0\\:f811\\:3ef2\\:fed7\\:98cc\\:vs6_2001_668_fc78_0_f811-3ef2-fed7_98cc-80. This must only be done on the lines with start with /Common and which also contain the string vs6....