![]() |
|
|
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 |
| Adding Multiple Lines to Multiple Files | dayinthelife | Shell Programming and Scripting | 2 | 06-04-2008 12:50 PM |
| retrieved multiple lines on multiple places in a file | dala | Shell Programming and Scripting | 8 | 03-14-2008 03:28 PM |
| copy value to multiple lines | rko | Shell Programming and Scripting | 4 | 12-13-2007 10:56 PM |
| grep multiple lines | jOOc | Shell Programming and Scripting | 6 | 11-20-2006 08:45 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 multiple lines
Hey guys:
I've been meaning to post this question for awhile...it is regarding grep. Let's say for example that the following entry is in logxx: Wed Feb 2 07:44:11 <vsm> 91030 Line 5 Severity 1 Vps 6 Call Answered - DN:8753101 CLID:5164665761 PI:83 If I do a grep 91030 logxx, I will get the following: Wed Feb 2 07:44:11 <vsm> 91030 Line 5 Severity 1 Vps 6 However, what I really want are BOTH lines. Is there a way to grep and have it return both lines?? Thanks, -cd |
|
||||
|
That did not work either. Here's the error:
grep: illegal option -- A grep: illegal option -- 1 Usage: grep -hblcnsviw pattern file . . . Here's my box info: ROOT@arivrc: uname -a SunOS arivrc 5.6 Generic_105181-35 sun4u sparc SUNW,UltraSPARC-IIi-Engine |
|
||||
|
That did not work either. Let me see if I can be a little more specific.
Let's say I want to grep xx from logyy. I want not only the instance of xx to return, but the line directly below it as well (no matter what it is). So basically, I am telling the shell..."find xx in my log yy. Every time you find it, show it to me, and while your at it, give me the line below it as well". Does that make more sense?? -cd |
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|