![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 | ||
|
|
![]() |
| Bookmarks |
| Tags |
| awk, awk trim, trim, trim awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|