help-cfengine
[Top][All Lists]
Advanced

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

take action if line exists


From: Mark McCullough
Subject: take action if line exists
Date: Thu, 03 Nov 2005 10:11:26 -0600

I've been finding myself more and more wanting to take an editfile
action if and only if a line exists in a file.  I know, I could
hypothetically use LocateLineMatching, but I have lots of edits that
need to be done to the file if and only if a certain line exists.

What I seem to be wanting is something along the lines of:

BeginGroupIfLineMatching
...
EndGroup

In other words, a complement to the old standby of
BeginGroupIfNoLineMatching

I haven't figured out a reasonable method shy of using a class defined
by a grep output to trigger this, and that becomes problematic for me
when I go multi-platform.  (Solaris requires /usr/xpg4/grep for grep -q,
Linux has it internal, ...)

Or is there some easy way I'm overlooking to do this?

-- 
mmccul@earthlink.net                                   Mark McCullough
"To announce that there must be no criticism of the President, or that 
we are to stand by the President, right or wrong, is not only 
unpatriotic and servile, but is morally treasonable to the American 
public." (Theodore Roosevelt, 1918)

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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