I have to a add 2 lines to /etc/sudoers file under this section below, can someone please suggest script to add these two lines when execute this remotely on to a multiple servers.
before
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
After
## Allow root to run any commands anywhere
root## Allow root to run any commands anywhere
root ALL=(ALL) ALL
man ALL=(ALL) ALL
moon ALL=(ALL) ALL
Use the "a" subcommand of "sed" to append a line. You need to escape every embedded newline in the appended string by a "\". Use some regexp to anchor at a certain line. For instance: append line after a line starting with "@@":
sed '/^@@/ a \
some text\
some more text' /path/to/infile > /path/to/outfile