Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-10-2006, 03:16 PM   #1
LQ Newbie
Registered: Sep 2004
Posts: 12

Rep: Reputation: 0
using egrep and excluding lines beginning in #


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.

Old 05-10-2006, 03:19 PM   #2
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
`egrep -v ^#` will exclude the lines beginning with #
Old 05-10-2006, 03:27 PM   #3
LQ Newbie
Registered: Sep 2004
Posts: 12

Original Poster
Rep: Reputation: 0
thanks for the quick reply, thats perfect.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
printer printing vertical lines at beginning and end of lines makhand Linux - Hardware 0 09-02-2005 03:03 PM
egrep question internal_war Linux - Newbie 6 05-05-2005 07:32 PM
Help with egrep smart_sagittari Linux - Newbie 2 05-02-2005 09:18 AM
vi command to find and delete all lines beginning with a character geomatt Linux - Software 8 12-20-2004 04:30 AM
Using egrep Barbarian Programming 5 10-20-2002 03:54 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration