contextual data with grep
If you need to print a certain number of lines before and/or a pattern match, grep can achieve this with the -B{number} and -A{number} options. This can be very useful when looking through logs and trying to determine what events took place immediately before and/or after…