Oh, I'd do it that way, but I'm pretty blamed lazy.
Sometimes it takes longer to get the SED script right than to hand edit the whole thing.
https://www.digitalocean.com/community/tutorials/the-basics-of-using-the-sed-stream-editor-to-manipulate-text-in-linux