![]() |
|
|
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 and display n lines after the match is found. | cv_pan | UNIX for Dummies Questions & Answers | 3 | 09-26-2008 12:15 AM |
| Display file without # lines | dave123 | Shell Programming and Scripting | 5 | 06-28-2008 01:22 PM |
| Display lines of the file on a log | sbryant | Shell Programming and Scripting | 2 | 02-26-2008 02:16 PM |
| display few lines of the file | sharuvman | UNIX for Dummies Questions & Answers | 4 | 04-27-2004 08:14 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
grep and display lines from a file
I have to grep on a few words in a file and then display the line containing those words and the line above it.
For ex - File1.txt contains... abc xyz abc This is a test Test successful abc xyz abc Just a test Test successful I find the words 'Test successful' in the file and then I have to display the line containing these words and the line above it. So my output should be... This is a test Test successful Just a test Test successful I am just not sure how to display the line above the 'Test successful' in my result. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|