sed remove match and next lines -
not sure why redgex expression not working, i'm trying ommit match , next lines
[example.com] 10.0.0.1 10.0.0.2 [example.net] 10.0.0.10 10.0.0.20
desired output
[example.net] 10.0.0.10 10.0.0.20
here have tried far, matches more lines desired
sed -e '/(\[example.com\])(.*\n)+/d'
sed simple subsitutions on individual lines, all. else should using awk every desirable attribute of software (efficiency, clarity, robustness, portability, maintainability, etc., etc.):
$ awk '/^\[/{f=/\[example\.com\]/} f' file [example.com] 10.0.0.1 10.0.0.2 $ awk '/^\[/{f=/\[example\.com\]/} !f' file [example.net] 10.0.0.10 10.0.0.20
Comments
Post a Comment