Reputation: 36166
I need to strip down all console
statements (console.log, console.error
, etc) from all javascript files in a folder. How do I do that?
trying this:
perl -pi -e "s/console.(.*);/g" *.js
doesn't work properly. I have to delete everything that starts with console. and end with closing parenthesis, not semicolon
Upvotes: 0
Views: 57
Reputation:
Not tried but what about a short sed
?
For example:
find . -name "*.js" -exec sed -i "s/console\.[^\)]+\);//g" '{}' \;
Upvotes: 1
Reputation: 3406
Supposing that all your console
commands are in separate lines you can try something like this
perl -pi -e "s/^\s*console\.\(.*?\);\s*$//g" *.js
Upvotes: 1