in reply to Regexp to exclude one IP and get all others?
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp to exclude one IP and get all others?
by bowei_99 (Friar) on Apr 15, 2010 at 20:07 UTC |