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
search for a string spread in multiple line finder255 Shell Programming and Scripting 1 10-22-2008 04:25 PM
Multiple Line search using grep pistachio UNIX for Dummies Questions & Answers 6 09-06-2008 11:11 AM
Perl: Match a line with multiple search patterns Juha Shell Programming and Scripting 10 04-09-2008 01:43 AM
Multiple file processing - 1st line only to process - search/match substring toneatlondon Shell Programming and Scripting 2 01-02-2008 09:20 PM
two lines into one colon separated line... tonlu Shell Programming and Scripting 2 03-30-2005 10:27 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 12-22-2008
reddyrajal reddyrajal is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 24
A for after
grep -A 3 print three lines

Last edited by reddyrajal; 12-22-2008 at 09:39 AM..
  #9 (permalink)  
Old 12-22-2008
reddyrajal reddyrajal is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 24
start=1;
grep -n ^$ file | sed s/:// | while read lineno
do
end=$lineno;
cat file | sed -n "$start,$end p" | grep -m 1 Enter
cat file | sed -n "$start,$end p" | grep -m 1 "SQL RUN"
cat file | sed -n "$start,$end p" | grep -m 1 '@'
start=$end
done

i think this may help you. this not efficient method.
the logic is
print lines between two blank lines and grep first occerence of "Enter" , grep first occerence of "SQL RUN" and grep first occerence of "@"

or try this
start=1;
grep -n ^$ file | sed s/:// | while read lineno
do
end=$lineno;
cat file | sed -n "$start,$end p" | egrep -m 3 'Enter|SQL RUN|@'
start=$end
done

Last edited by reddyrajal; 12-23-2008 at 02:56 AM..
Sponsored Links
Closed Thread

Bookmarks

Tags
awk, awk trim, trim, trim awk

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 04:54 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