help-cfengine
[Top][All Lists]
Advanced

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

RE: Three-Line service comments


From: Tim Auckland
Subject: RE: Three-Line service comments
Date: Fri, 3 Aug 2001 11:25:02 -0700

If I'm using 30-year old tools like sed and awk then I will make such
allowances for their limitations, but as Adrian indicated, perl has no
problem with this.  I was just hoping cfengine's own facilities would be
sufficient for the task.

This seems to do the trick, removing the comments and most common
variants:

   !GnatsServers::
   { /etc/inet/inetd.conf
      SetScript "perl -00 -pi -e 'BEGIN{pop};s/((\n#)*\n#
GNATS(\n#)*)*\n.*gnatsd//'"
      RunScriptIfLineMatching "support.*gnatsd$"
   }

Thanks,
  Tim

> The routines generally match single lines, but you could 
> possibly do some kind of begin-end construction which would 
> do it. But....
> 
> A piece of advice from a lazy person: I would never
> consider doing someting this complex. Why not use a
> simple protocol for your comments
> 
> # (special char)
> # (special char)  My comment
> # (Special char)
> 
> e.g.
> 
> # ftp
> # ftp  Start my favourite thingy with ftp..
> # ftp
> 
> ftp ....
> 
> Now it is trivial to delete all lines starting "# ftp .*" or 
"ftp.*" When it comes to automation, human aesthetics are seldom
practical.

Mark

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  Mark.Burgess@iu.hio.no
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]