Removes comments # (results in empty lines) and empty lines from file in place.
sed -i -e 's/#.*$//' -e '/^$/d' fileName
Example
Strips php.ini of all comments and all empty lines, perfect for diffing.
sed -i -e 's/;.*$//' -e '/^$/d' php.ini
Removes comments # (results in empty lines) and empty lines from file in place.
sed -i -e 's/#.*$//' -e '/^$/d' fileName
Strips php.ini of all comments and all empty lines, perfect for diffing.
sed -i -e 's/;.*$//' -e '/^$/d' php.ini