help-cfengine
[Top][All Lists]
Advanced

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

Re: non-convergent file edit?


From: Chris Edillon
Subject: Re: non-convergent file edit?
Date: Tue, 16 Mar 2004 10:32:18 -0400 (GMT+4)

On Tue, 16 Mar 2004 rader@ginseng.hep.wisc.edu wrote:

> Assume...
> 
>  echo "01Jan70" > f
> 
> then is there a way to do
> 
>  mv f f.OLD && \
>  cat f.OLD | perl -ne "s/\d\d\w\w\w\d\d/`date +%d%h%y`/; print" > f && \
>  rm f.OLD
> 
> with editfiles??
> 
> Just curious.  Using shellcommands is a reasonable solution. 
> 
  you could do something like this:

    any::
        { /tmp/f
          ReplaceAll "[[:digit:]]{2}[[:alpha:]]{3}[[:digit:]]{2}" With
"$(day)$(month)$(year)"
        }


but cfagent will complain that it is non-convergent since the string
you'd put in place will always match the regex so it will get re-edited
every run.  if you know that all of the date strings in question are
of a certain year or have some other static characteristic you could
put in the regex, it might work.  note that $(year) is a four digit
string.

chris





reply via email to

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