Paul on 11 Nov 2003 01:06:01 -0500


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

Re: [PLUG] regexp assistance please


Stephen Gran wrote:

I am trying to write a regexp that lets me use grep (or really, egrep)
to read a standard conffile-style file. This means that I want to
ignore any line that begins with a comment (for which I am currently
only allowing the use of #), any line that is just a newline, and any
line that is just whitespace (we don't need to worry about the
possibility of multiline strings in this case). I can come up with
egrep -v '^#|^$' to ignore comments and _only_ newlines, but I would
also like to ignore unseen whitespace (like \s*) - [:space:] just doesn't seem to be working for me. Can somebody whack me with a cluebat?




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.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug