Forum: CFEngine Help Subject: issue using PCRE regex to filter part of the line Author: milindk Link to topic: https://cfengine.com/forum/read.php?3,24600,24600#msg-24600
I want to append every kernel like in grub.conf with elevator=noop , but I want to filter the lines from appending the elevator=noop if the line already contains elevator keyword , the position of keyword may vary in the file I tried using regex with lookback/lookahead options to filter out the lines something similar to * (?!elevator=.*) * but not able to filter out lines any other way I can achive this sample file is title Red Hat Enterprise Linux Server (2.6.18-274.3.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=/dev/vg_root/lv_root pci=bfsort crashkernel=128M@16M iommu=soft initrd /initrd-2.6.18-274.3.1.el5.img title Red Hat Enterprise Linux Server (2.6.18-194.32.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=/dev/vg_root/lv_root pci=bfsort crashkernel=128M@16M elevator=noop initrd /initrd-2.6.18-194.32.1.el5.img title Red Hat Enterprise Linux Server (2.6.18-194.32.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-234.32.1.el5 ro root=/dev/vg_root/lv_root pci=bfsort elevator=deadline crashkernel=128M@16M initrd /initrd-2.6.18-194.32.1.el5.img title Red Hat Enterprise Linux Server (2.6.18-194.32.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=/dev/vg_root/lv_root pci=bfsort crashkernel=128M@16M initrd /initrd-2.6.18-194.32.1.el5.img In this example I do not want promise bundle to touch line with elevator=* but only append the one that does not have elevator keyword _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine