Article 4QBVB Can sed replace multiple occurrences in a single line?

Can sed replace multiple occurrences in a single line?

by
halfpower
from LinuxQuestions.org on (#4QBVB)
I have the following string:
Code:ABCABCI want to output
Code:A B C A B CI've tried doing it this way:
Code:echo "ABCABC" | sed -E "s:(A)(B)(C)(.*):\1 \2 \3 \4:g"However, this produces
Code:A B C ABCIn my problem, the substring ABC can occur N times. Is sed capable of producing the desired output?latest?d=yIl2AUoC8zA latest?i=r6qgRm-Z6aY:bvAQHCYJ15M:F7zBnMy latest?i=r6qgRm-Z6aY:bvAQHCYJ15M:V_sGLiP latest?d=qj6IDK7rITs latest?i=r6qgRm-Z6aY:bvAQHCYJ15M:gIN9vFwr6qgRm-Z6aY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments