title: Using AWK to add two parameter into a config inside a double quotes
body: <p>I Would like to use a awk or sed command and produce a script for hardening the /etc/default/grub file:</p>
  
  <p><strong>the original config file is like this:</strong></p>
  
  <pre><code>GRUB_TIMEOUT=5
  GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
  GRUB_DEFAULT=saved
  GRUB_DISABLE_SUBMENU=true
  GRUB_TERMINAL_OUTPUT="console"
  GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/vg00-swap rd.lvm.lv=vg00/root rd.lvm.lv=vg00/swap rhgb quiet"
  GRUB_DISABLE_RECOVERY="true"
  GRUB_ENABLE_BLSCFG=true
  </code></pre>
  
  <p>and would like to add "ipv6.disable=1 audit=1" inside the line GRUB_CMDLINE_LINUX= 
  the problem is the config is quoted inside a double quote , therefore i cannot output it successfully with a awk command</p>
  
  <p><strong>The Desired output is as follow:</strong></p>
  
  <pre><code>GRUB_TIMEOUT=5
      GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
      GRUB_DEFAULT=saved
      GRUB_DISABLE_SUBMENU=true
      GRUB_TERMINAL_OUTPUT="console"
      GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/vg00-swap rd.lvm.lv=vg00/root rd.lvm.lv=vg00/swap rhgb quiet ipv6.disable=1 audit=1"
      GRUB_DISABLE_RECOVERY="true"
      GRUB_ENABLE_BLSCFG=true
  </code></pre>
  
  <p><strong>What I had tried is as follow, but the resulting parameter is not inside the double quote:</strong></p>
  
  <p><code>awk '/GRUB_CMDLINE_LINUX/{$0=$0" ipv6.disable=1 audit=1"}{print}' /etc/default/grub</code></p>
  
  <pre><code>GRUB_TIMEOUT=5
  GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
  GRUB_DEFAULT=saved
  GRUB_DISABLE_SUBMENU=true
  GRUB_TERMINAL_OUTPUT="console"
  GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/vg00-swap rd.lvm.lv=vg00/root rd.lvm.lv=vg00/swap rhgb quiet" ipv6.disable=1 audit=1
  GRUB_DISABLE_RECOVERY="true"
  GRUB_ENABLE_BLSCFG=true
  </code></pre>
  
  <p>Anyone please can help me?</p>