Reccursively Remove Comments From Files
Posted Aug 15th, 2010 by Conor in in Bash,LanguagesThe following remove various types of comments from multiple files:
/* */
find . -type f -exec perl -i -wpe ‘BEGIN{undef $/} s!/\*.*?\*/!!sg’ {} \;
Removes all /* */ comments from all files in the current directory, and subdirectories.
#
find . -type f -exec sed -i ” ‘/^#/d’ {} \;
Removes all # comments from all files and in the current directory and subdirectories.