Using grep
:
$ grep -A1 '/2' file
>1234/2
B
--
>8976/2
D
From the man
page:
-A num, --after-context=num
Print num lines of trailing context after each match.
You can remove the --
by piping it to grep -v '--'
or if you have GNU grep
then you can simply do:
$ grep --no-group-separator -A1 '/2' file
>1234/2
B
>8976/2
D
You can re-direct the output of this command to another file.