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

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -