Strip comments from a file

Contributor Icon Contributed by skreuzer Date Icon October 18, 2003  
Tag Icon Tagged: UNIX

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


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

Previous recipe | Next recipe |
 
blog comments powered by Disqus