I want to process a file block by block using sed, and if that block does not contain two patterns, then that complete block has to be printed.
See below for the example data.
................................server 1...............................
running process 1
running process 2
running process 3
date : 12/12/2012
............................................................................
................................server 2...............................
running process 1
stopped process 2
running process 3
date : 13/12/2012
............................................................................
in the above mentioned file a block refers from
.........server................. to ........................
in that block i have to check, if there is no pattern "stop" and "13/12/2012" then i have to print that block.
this is what i have tried till now
sed -n -e '/./{H;/\.\.\.\./!d;}' -e 'x;/stop/ !{ /13.12.2012/ !{p;}}' example
the output iam getting is given below
................................server 1...............................
................................server 1...............................
running process 1
running process 2
running process 3
date : 12/12/2012
............................................................................
............................................................................
................................server 2...............................
The required output is
................................server 1...............................
running process 1
running process 2
running process 3
date : 12/12/2012
............................................................................
Please let me know what am I doing wrong.