I have a sed command that removes comments in a file as,
sed -i /^#/d /path/to/file
This works but not when the comments are indented/have a preceding space.
like
#this is a good comment ---- works
#this is an indented comment ---- doesn't work
How can i change it to remove lines that has # as the first visible character?