sed -i -r '/^[\s\t]*[#;]/d' php.ini
# 2024-07-28
# The previous command does not remove comments from lines indented with spaces (for an unknown reason).
# So I remove these comments using another command below.
sed -i -r '/^\s\+[#;]/d' php.ini
sed -i -r '/^\s*$/d' php.ini
For all files *.ini
in the current folder and subfolders:
find . -name '*.ini' -type f -exec sed -i -r '/^[\s\t]*[#;]/d' {} +
# 2024-07-28
# The previous command does not remove comments from lines indented with spaces (for an unknown reason).
# So I remove these comments using another command below.
find . -name '*.ini' -type f -exec sed -i -r '/^\s+[#;]/d' {} +
find . -name '*.ini' -type f -exec sed -i -r '/^\s*$/d' {} +