No. No, it's not trivial. Consider how you'd handle:
printf("*/ or \"/*");
To do it right, you need a lexical analyzer. Of course it can be done, but doing it with bash would be a nightmare.
Biting the hand that feeds IT © 1998–2019