linux/Unix tools for multiline grep
grep -A 2 SearchString
grep -B 3 SearchString
also,
pcregrep
pcregrep -M ‘a\nb’ files…
redirecting standard error (stderr) and standard output (stdout) to a file
Capturing both errors and normal list output from ls, with “long” and recursive options set, to a file called /tmp/allout :
ls -lR > /tmp/allout 2>&1