Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Perl Regex Remove words aftern pattern / comment out lines

    I am working on writing a Perl script to do the following actions:

    1)/boot/grub/grub.conf, comment out the "splashimage" line.
    2)Remove rhgb and quiet from kernel line of /boot/grub/grub.conf file.
    3)/etc/sysconfig/init, change the BOOTUP line to say "BOOTUP=verbose".

    It logically it seems easy but I am stuck on the regex parts. Any thoughts?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    I wouldnt go the regex route, as it is a bit errorprone.

    Imho, there are three ways of approaching it in a programmatic way.
    1) Use augeas
    This tool understands the gramar of certain config files and gives you control on how to modify them.
    2) Templates
    Based on a template and the available versions of kernels, the config files get generated
    3) File copy
    A bit too static for my taste, but it is possible to have a known good file in a central place and distribute it to all controlled nodes.

    All three methods can be done as part of a puppet deployment.
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts