Thanks. So I guess there is no way if I don't know what the exact line
will look like? Basically I could do a 'perl -pie' but was hoping I
could do it within cfengine.
Viraj.
On 11/6/05, Brendan Strejcek <[EMAIL PROTECTED]> wrote:
> Viraj Alankar wrote:
>
> > ...
> > /dev/sda2 /tmp ext3
> > defaults,nosuid,nodev,noexec 1 2
> > ...
> >
> > I would like to remove ',noexec' from this line only. I thought of
> > using LocateLineMatching to find the line, but am not sure how to do
> > the replacement.
>
> Here is a very careful way to do it, though it requires that you know
> the entire form of the line you want to end up with.
>
> control:
> fstab_line = ( "/dev/sda2 /tmp ext3 defaults,nosuid,nodev 1 2" )
>
> editfiles:
> { /etc/fstab
> AppendIfNoSuchLine "${fstab_line}"
> ResetSearch "1"
> LocateLineMatching "^/dev/sda2.*$"
> BeginGroupIfNoMatch "^${fstab_line}$"
> ReplaceLineWith "${fstab_line}"
> EndGroup
> DeleteLinesAfterThisMatching "^/dev/sda2.*$"
> CatchAbort
> }
_______________________________________________
Help-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cfengine