Stephen Gran on 11 Nov 2003 09:56:03 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] regexp assistance please


On Tue, Nov 11, 2003 at 12:45:22AM -0500, Michael C. Toren said:
> On Mon, Nov 10, 2003 at 10:45:00PM -0500, Stephen Gran wrote:
> > > The "[:space:]" needs to occur within a character class, which
> > > effectively requires the use of double square brackets.  Try:
> > > 
> > > 	egrep -v '^[[:space:]]*(#|$)'
> > 
> > Ah that explains my problem.  Thank you very much.  Just to mke sure I
> > am parsing your solution correctly, I read this as: if the line begins
> > with 0 or more spaces, followed by either # or newline, then ignore it -
> > yes?  That looks like exactly what I want.
> 
> Yup, you got it.  Ofcourse, if you'll be doing even further analysis of
> the output of the above grep command, you may want to investigate writing
> your application in a language more suited to text processing, such as
> perl.

I would have loved to, but this may be run before /usr is mounted, so
relying on perl may not work.  If I could have used perl, I wouldn't
have had to write in :)

On Tue, Nov 11, 2003 at 01:06:15AM -0500, Paul said:
> I know this isn't what you want to do, but I usually just put
> variables
> directly into the file and include the file in the main program.  That
> way there is no need to parse anything.

Unfortunately, that's not going to work either - this is going in a
debian package, and I want to rely on Debian's conffile handling, so I
need the main script to remain unmodified, while the conffile that it
reads is freely modifiable, without being overridden.

Thanks for all the help,
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | Keep your eyes wide open before         |
|  steve@lobefin.net             | marriage, half shut afterwards.   --    |
|  http://www.lobefin.net/~steve | Benjamin Franklin                       |
 --------------------------------------------------------------------------

Attachment: pgpxaX5aQ7PmV.pgp
Description: PGP signature