1 of 2
dandan
  • 1.1k
  • 4
  • 13
  • 21

sed + replace value default in grub.conf

I want to change the default value on all machines to default=0

default value could be any integer number

how to set in the sed syntax that default could be any number

my example ( not working )

for server_ip in $all-servers
   do
   ssh $server_ip  "sed -i s'/default=[0-9]/default=0/g' /etc/grub.conf"
done

example of grub.conf

  more /etc/grub.conf
  # grub.conf generated by anaconda
  #
  # Note that you do not have to rerun grub after making changes to this     file
  # NOTICE:  You have a /boot partition.  This means that
  #          all kernel and initrd paths are relative to /boot/, eg.
  #          root (hd0,0)
  #          kernel /vmlinuz-version ro root=/dev/rootvg/slash
  #          initrd /initrd-version.img
  #boot=/dev/cciss/c0d0
  default=2
dandan
  • 1.1k
  • 4
  • 13
  • 21