in reply to GRUB Append Parameter in-between Quotes

Hi ephemeric,

A little late but here's a try with Perl. This is like hippo's solution but it adds the detection of whether the parameter has already been added or not. Personally I don't mind breaking up regexes into several regexes if it helps in thinking about the solution.

perl -pe 's/"\s*$/ transparent_hugepage=never"/ if /^GRUB_CMDLINE_LINU +X=/ && !/transparent_hugepage/' filename

Hope this helps,
-- Hauke D

Replies are listed 'Best First'.
Re^2: GRUB Append Parameter in-between Quotes
by ephemeric (Novice) on Sep 20, 2016 at 09:34 UTC

    Thank you.