Some versions of grep or grep-like utilities can do this. For example, the very versatile cgrep can. Here is a sample of first extracting the string plus the trailing window, then the inversion of that operation, which effectively deletes it, both operations writing to STDOUT:
#!/usr/bin/env bash
# @(#) s2 Demonstrate effectively deleting lines with cgrep.
# http://www.bell-labs.com/project/wwexptools/cgrep/
echo
set +o nounset
LC_ALL=C ; LANG=C ; export LC_ALL LANG
echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1)
set -o nounset
echo
FILE=${1-data1}
echo " Data file $FILE (numbered for this display):"
cat -n $FILE
wc -l $FILE
rm -f t1
echo
echo " Results of matching + copy following:"
cgrep -D +5 "architecture x86_64" $FILE > t1
cat t1
echo " Lines extracted: $(wc -l <t1)"
rm -f t1
echo
echo " Results of matching + copy following with inversion flag:"
cgrep -D -V +5 "architecture x86_64" $FILE > t1
cat t1
echo " Lines extracted: $(wc -l <t1)"
exit 0
producing:
% ./s2
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0
GNU bash 3.2.39
Data file data1 (numbered for this display):
1 architecture x86_64
2 cputype CPU_TYPE_X86_64
3 cpusubtype CPU_SUBTYPE_X86_64_ALL
4 offset 4096
5 size 2972420
6 align 2^12 (4096)
7 architecture ppc64
8 cputype CPU_TYPE_POWERPC64
9 cpusubtype CPU_SUBTYPE_POWERPC_ALL
10 offset 2977792
11 size 2702672
12 align 2^12 (4096)
12 data1
Results of matching + copy following:
architecture x86_64
cputype CPU_TYPE_X86_64
cpusubtype CPU_SUBTYPE_X86_64_ALL
offset 4096
size 2972420
align 2^12 (4096)
Lines extracted: 6
Results of matching + copy following with inversion flag:
architecture ppc64
cputype CPU_TYPE_POWERPC64
cpusubtype CPU_SUBTYPE_POWERPC_ALL
offset 2977792
size 2702672
align 2^12 (4096)
Lines extracted: 6
So cgrep is not very diffferent from sed when cgrep is used this way. Where it might be superior to sed is in the selection of context window limits: regular expressions and line counts (the latter as shown above) can be used to mark easily the leading and trailing boundaries of a window.
You may need to download and compile cgrep, see the URL in the code above. I have done so on 32-bit and 64-bit GNU/Linux systems.