grep -B1
-B[n]
lets you see [n]
lines before the pattern that you are looking for.
You can also use -A
for 'lines after', and -C
for 'context' (lines both above and below).
You can also simplify your grep call and remove the pipe with grep xxx -B1 catalina.out
.