
body common control

{
version => "1.2.3";
bundlesequence  => { "testbundle"  };
}

########################################################

bundle agent testbundle

{

files:

  "/tmp/testfile"

       create    => "true",
       edit_line => myedit("second");
}

########################################################

bundle edit_line myedit(parameter)
  {
  vars:

   "edit_variable" string => "private edit variable is $(parameter)"; 

  
  replace_patterns:

  # comment out lines after start

   "([^#].*)"

      replace_with => comment,
     select_region => ToEnd("Start.*");

  }

########################################
# Bodies
########################################

body replace_with comment

{
replace_value => "# $(match.1)"; # backreference 0
occurrences => "all";  # first, last all
}

########################################################

body select_region ToEnd(x)

{
select_start => "$(x)";
}
