LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   using egrep and excluding lines beginning in # (https://www.linuxquestions.org/questions/programming-9/using-egrep-and-excluding-lines-beginning-in-443548/)

thebudbottle 05-10-2006 02:16 PM

using egrep and excluding lines beginning in #
 
Hi,

I am trying to write a script to check the contents of a file for a space that is not on a line that begins with # (comment). Spaces are illegal in the file, unless in comments. I know that ^ is used to match characters at the beginning of the line, but I dont know how to exclude those results and print lines that dont begin with # containing spaces. Anyone have any ideas? Thanks for the help.

Chris

uselpa 05-10-2006 02:19 PM

`egrep -v ^#` will exclude the lines beginning with #

thebudbottle 05-10-2006 02:27 PM

thanks for the quick reply, thats perfect.

chris


All times are GMT -5. The time now is 11:37 AM.