perl -p -i -e 's/server (?!\Q127.127.1.0\E)[\w\.]+\s+(?!prefer).*//g' ntp.conf
See perlretut for more info. And might I suggest -i.bak in place of -i?
In reply to Re: Regexp to exclude one IP and get all others?
by kennethk
in thread Regexp to exclude one IP and get all others?
by bowei_99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |