The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
printing the next line too?? AndyA Shell Programming and Scripting 6 01-31-2008 06:35 AM
egrep understanding problem namishtiwari Shell Programming and Scripting 1 01-29-2008 07:03 AM
Egrep cheat sheet anywhere? Looking for meaning of egrep -c leelm UNIX for Dummies Questions & Answers 2 01-11-2008 03:37 PM
adding blank line in egrep antalexi UNIX for Dummies Questions & Answers 2 05-24-2004 01:40 PM
Printing line numbers MizzGail UNIX for Dummies Questions & Answers 2 07-25-2002 05:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-23-2008
user__user3110 user__user3110 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 18
egrep problem | printing next line?????

Hi !!! Dear People,
Please help me with the following problem.
consider this output:
Top 5 Timed Events
~~~~~~~~~~~~ Total
Event Waits Time (s) Ela Time
---------------------------- ------------ ----------- -----
CPU time 2,152 54.10
free buffer 7,059 641 16.10
control file parallel write 19,625 490 12.31
log file sync 7,010 217 5.44
db file sequential read 3,000 1000 .99
--------------------------------------------------------
we all know ,if i give
egrep '^(log file sync)...' /oracle/user_user/2
it will print
log file sync 7,010 217 5.44
please tel me how to print next line using egrep.
meaning... it should print immediate next line of pattern matching character(here it's log file sync).
my desired output should be
db file sequential read 3,000 1000 .99

perhaps with the same pattern matching character

please help me to give the command.
im using default shell(-sh)

Thanks in Advance
  #2 (permalink)  
Old 06-23-2008
unSpawn unSpawn is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 53
Line before is "-B", "line after" is "-A". One line after is "-A1", see 'man grep'.
If you want to see only the next line you could pipe that through 'tac|head -1'.
  #3 (permalink)  
Old 06-24-2008
user__user3110 user__user3110 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 18
hay it's not working.. please give me full code......
  #4 (permalink)  
Old 06-24-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,311
Code:
awk '/^log file sync/{getline;print;exit}' file
Regards
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0