![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help on egrep | arund_01 | Shell Programming and Scripting | 2 | 05-13-2008 10:26 AM |
| egrep help | Darklight | Shell Programming and Scripting | 1 | 04-17-2008 11:34 PM |
| egrep | DNAx86 | Shell Programming and Scripting | 7 | 01-18-2008 05:59 AM |
| Egrep cheat sheet anywhere? Looking for meaning of egrep -c | leelm | UNIX for Dummies Questions & Answers | 2 | 01-11-2008 12:37 PM |
| egrep help | Vozx | Shell Programming and Scripting | 2 | 12-09-2005 07:42 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
So I guess I'm pretty much just looking for a command to find a match for a pattern, get the entire line, and the 4 lines that follow it, and print them to standard output.
|
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
see this
See if this awk works:
Code:
awk -v pat="knllgobjinfo" -v cnt=4 '$1~pat {print; for(i=1;i<=cnt;i++) {getline;print;} }' filename
|
|
#10
|
|||
|
|||
|
Sorry Mate That works in Linux,
but some what similar shld be tried as it prints only one line and you want 4 lines. host1_opt> sed -n -e '/knllgobjinfo/ {N;p;}' datafile knllgobjinfo: MISSING Streams multi-version data dictionary!!! knlldmm: gdbnm=FDROP |
|||
| Google The UNIX and Linux Forums |