title: grep surrounding lines in SunOS 5.9
body: <p>Trying to grep surrounding lines using SunOS 5.9, normally I would use grep with -B and -A to do so:</p>
  
  <pre><code>grep -B 3 -A 2 foo README.txt
  </code></pre>
  
  <p>However, in SunOS 5.9, grep don't support this feature with this error message:</p>
  
  <pre><code>grep: illegal option -- A
  </code></pre>
  
  <p>below is what I get from "man grep":<a href="http://www.freebsd.org/cgi/man.cgi?query=grep&amp;apropos=0&amp;sektion=0&amp;manpath=SunOS+5.9&amp;format=html" rel="nofollow">http://www.freebsd.org/cgi/man.cgi?query=grep&amp;apropos=0&amp;sektion=0&amp;manpath=SunOS+5.9&amp;format=html</a></p>
  
  <p>My example would be try to grep with keyword "Mirror" and those lines representing the state of its Submirror. Inputs to grep would be:</p>
  
  <pre><code>d6: Mirror
      Submirror 0: d61
        State: Okay
      Submirror 1: d62
        State: Okay
      Pass: 1
      Read option: ***
      Write option: ***
      Size: ***
  
  d61: Submirror of d6
      State: Okay
      Size: ***
      Stripe 0:
      Device     Start Block  Dbase        State Reloc Hot Spare
      CCC          0     No            Okay   Yes
  
  
  d62: Submirror of d6
      State: Okay
      Size: ***
      Stripe 0:
      Device     Start Block  Dbase        State Reloc Hot Spare
      BBB          0     No            Okay   Yes
  </code></pre>
  
  <p>In the above case, I want to get</p>
  
  <pre><code>d6: Mirror
      Submirror 0: d61
        State: Okay
      Submirror 1: d62
        State: Okay
  </code></pre>
  
  <p>How should I do so in SunOS 5.9?</p>