![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep and display few lines before and after | melanie_pfefer | SUN Solaris | 13 | 02-19-2009 11:54 PM |
| grep + lines after | Janus | Shell Programming and Scripting | 4 | 11-03-2006 05:56 PM |
| grep string & next n lines | ashterix | Shell Programming and Scripting | 8 | 11-21-2005 11:38 PM |
| Grep on multiple lines | gundu | Shell Programming and Scripting | 13 | 03-25-2005 02:43 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
grep -n lines before and after
Hi,
is it possible to grep a pattern that will include the "n" lines before and after the line where the pattern have been found? e.g. #this contains the test.file line1 line2 line3 line4 line5 then a grep command to search the word "line3" and the output should be 1 (or n) line before that line and 1 (or n) line "after" that line. dessired output of the grep command line2 line3 line4 Thanks in advance. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|