How to replace all characters between colons using sed
?
# replace easy with 123
sed:easy:abc -> sed:123:abc
# replace hardest with 123
sed:hardest:efg -> sed:123:efg
# replace magnificent with zyx
sed:magnificent:zyx -> sed:123:zyx
Try:
$ sed -e 's/:[^:]*:/:123:/' file
sed:123:abc
sed:123:efg
sed:123:zyx
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments