Skip to content

Instantly share code, notes, and snippets.

@sasuw
Last active August 22, 2019 09:27
Show Gist options
  • Select an option

  • Save sasuw/652ad992d498eb502fd48445fbc7d7dd to your computer and use it in GitHub Desktop.

Select an option

Save sasuw/652ad992d498eb502fd48445fbc7d7dd to your computer and use it in GitHub Desktop.
Remove java comments in-file
#one file
perl -i -0pe 's|//.*?\n|\n|g; s#/\*(.|\n)*?\*/##g;' file.java
#multiple files
find . -name "*.java" -type f | while read fname; do perl -i -0pe 's|//.*?\n|\n|g; s#/\*(.|\n)*?\*/##g;' "$fname"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment