Installation:
bash
cargo install collclean
Example call
bash
collclean file.tex mycomm1 mycomm2 ...
file.tex
(if it does not compile, collclean will remove nothing)
tex
\mycomm1{I wrote that!}
\mycomm2{I wrote that! \mycomm2{lalalala} y\{y{y}y{} }
file.tex
afterwards
tex
I wrote that!
I wrote that! lalalala y\{y{y}y{}
The command definitions (e.g. via \newcommand
) will not get removed.
Output to new file
bash
collclean file.tex mycomm1 -o new_file.tex