Windowing grep output

From: Spalding, Steve <SSPALDIN_at_mem-ins.com>
Date: Mon, 16 Mar 1998 09:14 -0600

Hi all!

I've got an easy one for you this morning. I am wondering, how do you
window the output of a grep command to include the line before and/or
line after the matched string? I say "window" the output because that is
the name of the switch that you use in VMS along with the search command.


For example, if you had a file that looked like this:


Digital UNIX V4.0B (Rev. 564); Sun Feb 8 18:46:00 CST 1998
**************************************************************************
**
Missouri Employers Mutual Insurance
Creating a Healthy and Accident-Free Workplace.
**************************************************************************
**
Mon Mar 16 09:12:01 CST 1998


and you did a search for "employers" but you wanted to see the line
before and after the line that contained "employers" so that the output
would look like this:


**************************************************************************
**
Missouri Employers Mutual Insurance
Creating a Healthy and Accident-Free Workplace.


what command would you type in?

Thanks!




Stephen Spalding
sspaldin_at_mem-ins.com
Missouri Employers Mutual Insurance
Received on Mon Mar 16 1998 - 17:02:58 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT