Strip comments from a file

Posted by skreuzer in UNIX

This one liner will remove all text after the # character in a file


cat file-with-comments | sed -e 's;#.*;;' -e '/^[ ]*$/d'

The Conversation

Follow the reactions below and share your own thoughts.