print 2 lines above regexp

I am on a Solaris 10 x86 system

sample code

before3
before2
before1
group
after1
after2
after3

I want to grab the second line above my regexp

regexp=group
I want to grab ONLY the before2 line

I have numerous sed and awk ways of grabbing X line below the regexp, but no luck yet getting awk or sed to work with a line X above regexp

I have tried sed, awk and grep and no luck. I can grab 1 line above the regexp but not 2 lines up.

I am interested in a one-liner to do the trick.

I think I will have to settle installing GNU grep.

awk
|awk '/group/ { print x }; { x=$0 }' # works for 1 line above

Well, I just found the answer, and this is it

|awk '{lines[NR] = $0} /group/ {print lines [NR-2]} {delete lines[NR-2]}'

plug in any number lines above 
 wow, I must have googled for hours on this one!

 it would have been helpful if people also list which sed|awk|grep they are using as it may not work on every system.

FOr instance I could never get this one to work
| sed -n '/group/{g;2!p;};h'

I will still post this for others to see.

Also if there is a definitive sed/awk/grep guide on grabbing surrounding lines from a regexp please let me know.
single lines above/below regexp
numerous lines above/below regexp

I love to find numerous ways to do the same thing in *nix

The GNU grep does sound very flexible. Does anyone know where I can download it for Solaris 10 x86?
And does GNU grep come bundled in the GNU coreutils by chance or is it a standalone package?

Thanks

awk ' { a= b; b=c; c=$0 } c ~ "group" { print a; exit } ' file