Script and Comments
Script1
[ 1] /PAT/!d
[ 2] N;N;N
Comments
  1. Each time a line containing PAT is reached, sed will proceed to step [2]; otherwise, empty the pattern space and start a new cycle.
  2. Three 'N' commands in Step [2] will append next 3 lines. Note that this script will NOT examine whether these three lines containing PAT or not!
Description
Assume that datafile contains 4-line records.
Each record keeps (Dept,ID,Name,Age).
Now we want to list all the records where 'Dept=MIS'.
Raw Input Desired Output
Dept=MIS
ID=00154
Name=John
Age=23
Dept=ACCOUNTING
ID=00312
Name=Mary
Age=26
Dept=SALES
No=00439
Name=Tom
Age=30
Dept=MIS
No=00183
Name=Ruth
Age=25
Dept=MIS
ID=00154
Name=John
Age=23
Dept=MIS
No=00183
Name=Ruth
Age=25