Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting from start to end of record based on messeger number

Status
Not open for further replies.

mojo24

ISP
Sep 8, 2005
8
GB
I want to export from a log file.from ^START to ^END only if that record is from "BUSORG_ORID#" i want

So far I have...
awk /^START/,/^END/ *.rv >results.txt # this is able to divide the text file into the sections i want.


and i was thinking about something like...

awk /^START/,/^END/ && $2==380217 *.rv>results.txt

START: Mon Apr 24 10:08:59 2006:
Mon Apr 24 10:08:59 2006: service: before tpcall(), buffer being sent...
CLFY_SUB ViewMoneyMarkets
MESSAGE_ID 5E12F6DF-2122-4DE7-A049-2280CCCFC3E1
BUSORG_ORGID 380217

E_NUMBER 0
G_ROWCOUNT 1
END:
 
Hi

I see no way to do it that simple. While the code is in the middle of the secion, I think you have to stack up the lines and output them at the end if the condition was matched.
Code:
/^START/ { ok=0; sec="" }
/^START/,/^END/ { sec=sec "\n" $0 }
$2==380217 { ok=1 }
/^END/ && ok { print sec }

Feherke.
 
Yep, I agree... it would be very handy if you could use the /start/,/finish/ syntax with additional logic, but it has never worked for me.

Annihilannic.
 
Thankyou that works great !!!!

I am going to start looking at lookinf between times and dates next but not untill tommorrow !

Thankyou again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top