I tried so many but it doesn't seem to work on macOS Terminal. My file contains the String this is an example
zero to multiple times. After this the script should insert a new line followed by another String, for example this is an inserted line
and safe it back to the original file (in concrete case the sudoers file should be modified).
I didn't got the participle of the syntax of sed
on macOS, so I would be pleasured if I get a functional script with an understandable explanation. Thanks! :)
EDIT
Here's one sample command, the script should find %admin ALL=(ALL) ALL
from the sudoers file, then insert a new line and the current account.
sudo cat /etc/sudoers | sed 'a/\%admin ALL=(ALL) ALL\
testaccount ALL=(ALL) ALL' > test.txt