If this hasn't been mentioned before (I searched), I'm surprised.
Zillions of requests for additional post-processing functionality in process scripts, and the additional terminal commands (Scripts tab). All gothings od, and many generally needed, features.
Massively inefficient to reinvent the wheel, again(!!), for this sort of thing. There are so many text parsing/processing applications available already, without installation, that can easily do anything a user wants. Most if not all of the needed information is already in the comment headers S3D generates (layer #, process, layer height, etc).
So, what we really need, before any time is spent on implementing more post-processing features, is simply the ability to have S3D run an external process (like python, a shell script, perl, etc. etc. etc.) on the generated g-code. Include a checkbox to have the visualizer use either the post-processed code, or the original code.
This would solve so many problems for the vast majority of your users, who have the technical skills to script perl, shell, whatever.
Man this would make my life much easier. I already do this anyway for anything more complex than simple substitutions, but it's cumbersome to have to save the generated code, go to a terminal window, run it through perl, then open the output in S3D to visualize the modifications and make sure everythings kosher.