print range of lines matching pattern and previous line

Hi all,

on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern.
the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/'
I need to include the range of files going up to end of file $
I tried several syntax but nothing works
Any help would be very much appreciated.
siriche

Try awk

awk '
/startpattern/,/endpattern/ {
  if ( prev&&done==0 ) {
    print prev
    done=1
  }
  print
} 
{
  prev=$0
} 
/endpattern/ {
  exit(0)
}' yourfile