# How do I remove all occurrences of certain latex commands from a tex file

In my tex file I have a bunch of commands of the form \bla{ ... }, where the ... may span several lines. These commands \bla{ ... } contain some notes for myself, and should be removed from the tex file before sending it to my publisher. Note that I am supposed to send the tex file, not the pdf, so I cannot simply redefine the \bla macro to an empty macro. Any thoughts on how to do this as quickly as possible with a linux terminal command? (Or any other trick)

• So, what you want is to delete everything from \bla{ to }? The problem is that you have to take care of nested braces, for example, \bla{foo \textit{faa}}. You can not delete until first }. – Sigur Apr 5 at 15:57
• yes, even if there are new lines, and yes the nested braces are the one of the issues (also new lines). – mnr Apr 5 at 15:59
• So, maybe it is better to ask on another SE site, maybe StackOverflow, and ask how to manipulate text files and strings. – Sigur Apr 5 at 16:01
• Half joke, half serious: Does it take more time trying to find out a way to do this automatically or just doing it by hand? ;-) – campa Apr 5 at 16:02
• I made a simple program in C that did it in about 30 min, doing it by hand would have taken me longer I think, and this is not the first time I run into this. So it seemed to be worth the efford – mnr Apr 6 at 22:40