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
grep -n lines before and after airman_ole Shell Programming and Scripting 5 07-05-2009 10:57 PM
grep and display few lines before and after melanie_pfefer SUN Solaris 13 02-19-2009 11:54 PM
Print lines after grep jakSun8 Shell Programming and Scripting 4 06-25-2008 02:34 PM
Grep two lines at a time joshjimda Shell Programming and Scripting 6 03-26-2008 03:18 PM
grep + lines after Janus Shell Programming and Scripting 4 11-03-2006 05:56 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 07-16-2008
arghya_owen arghya_owen is offline
Registered User
  
 

Join Date: May 2008
Posts: 31
grep and fetching lines after grep

suppose i have a file structure(serial file)--
----------
----------
---------
summery
--------
------
--------
finished
-----
-------
i want to fetch lines from summery to finished
i can get line of summery by grep command. but how can i fetch lines untill it reaches finished.probably i have to use loop..pleaseeeeeeee help...
  #2 (permalink)  
Old 07-16-2008
arghya_owen arghya_owen is offline
Registered User
  
 

Join Date: May 2008
Posts: 31
from grep -n 'summery' a.log
and
grep -n 'finished' a.log----we can get 2 line numbers.now how can i print lines between two line numbers.
  #3 (permalink)  
Old 07-16-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,285
Code:
sed -n '/summery/,/finished/p' infile
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 07:16 PM.


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