LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 0
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
 
Old 05-10-2006, 02:19 PM   #2
uselpa
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, 02:27 PM   #3
thebudbottle
LQ Newbie
 
Registered: Sep 2004
Posts: 12

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

chris
 
  


Reply


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 02:03 PM
egrep question internal_war Linux - Newbie 6 05-05-2005 06:32 PM
Help with egrep smart_sagittari Linux - Newbie 2 05-02-2005 08:18 AM
vi command to find and delete all lines beginning with a character geomatt Linux - Software 8 12-20-2004 03:30 AM
Using egrep Barbarian Programming 5 10-20-2002 02:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:20 AM.

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