The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 08-01-2006
Registered User
 

Join Date: Jul 2006
Posts: 4
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.
Reply With Quote
Forum Sponsor
  #9  
Old 08-01-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
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
Reply With Quote
  #10  
Old 08-02-2006
Registered User
 

Join Date: Jan 2006
Posts: 43
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0