- Open fileC for writing.
- Open fileB for reading.
- Read in fileB up to and including the SEARCHPATTERN.
- Write everything you've read into fileC.
- Open fileA for reading.
- Read in fileA, write it to fileC.
- Close fileA.
- Read the rest of fileB, writing it to fileC.
- Close fileB.
- Close fileC.
- Rename fileC to fileB.
Or in an (untested) Perl/shell one-liner:
perl -ne 'print; print `cat fileA` if /SEARCHPATTERN/' fileB > fileC &
+& mv fileC fileB