LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   looking for script - strip out all # comments (http://www.linuxquestions.org/questions/programming-9/looking-for-script-strip-out-all-comments-147871/)

itsjustme 02-18-2004 11:25 PM

looking for script - strip out all # comments
 
Hey, you scripters....

Anybody got a simple script I can use, sorta like:

$ strip_comments /etc/rc.d/rc.modules

and have the output just show all lines that don't have # in the first column?
This is no emergency or anything.

Thanks if you do and can post it...

I just haven't gotten around to writing any scripts yet.

Strike 02-19-2004 02:36 AM

grep -v "^#"

Pipe anything you want to that :)

itsjustme 02-21-2004 05:23 PM

Strike...

Exactly what I as looking for.

Thanks!!

bigearsbilly 03-11-2004 10:57 AM

If the comment is NOT the first character,
Like # here for instance

cat file | sed 's/#.*//' | grep .


billy


All times are GMT -5. The time now is 09:16 AM.