Operating System - HP-UX
1836872 Members
2033 Online
110110 Solutions
New Discussion

Re: Script help....please....

 
SOLVED
Go to solution
Vic S. Kelan
Regular Advisor

Script help....please....

Hi!
I am trying to get some information from 3 huge log files that dates back to 2000/2001..

I need to pull out this information for example which occurs every week since August of 2000:
Dates
--------------------------------------------------------------------------------
From 20000827 to 20000902


CLM_CNT AVG_RESP TM_OUT_CNT PCT_TM_OUT
---------- -------- ---------- ----------
410579 1.29 1622 .004

This is all I need the Line that starts with 'Dates' the line that starts with '-' and the line that starts with 'From'.

And for the second part line starting with 'CLM_CNT' line with '-' and the 3rd line which varies weekly.

I have a lot of other "stuff" in the log file I dont need and also lots of repitions of the search criteria such as 'Dates' 'From' etc...

I am attaching a bit of each of the logs

thanks!!
3 REPLIES 3
Volker Borowski
Honored Contributor
Solution

Re: Script help....please....

Shot one:


awk '/^Dates/,/^From/ { print }
/^ CLM_CNT/ { print
getline
print
getline
print } ' data.log

tested with LOG2 produces

Dates
--------------------------------------------------------------------------------
From 20010815 to 20010820
CLM_CNT AVG_RESP TM_OUT_CNT PCT_TM_OUT
---------- -------- ---------- ----------
356971 1.22 1085 .003
Dates
--------------------------------------------------------------------------------
From 20010815 to 20010820
CLM_CNT AVG_RESP TM_OUT_CNT PCT_TM_OUT
---------- -------- ---------- ----------
356971 1.22 1085 .003



Three blanks between "^" and "CLM_CNT" in this line:
/^ CLM_CNT/

Regards
Volker
Sandman!
Honored Contributor

Re: Script help....please....

Hi Vic,

How about some simple ex scripting...

# ex -s inputfile<> g/^Dates/p 3
> g/PCT_TM_OUT$/p 3
> EOF

cheers!
Vic S. Kelan
Regular Advisor

Re: Script help....please....

Hey!!
Thanks a Volker & Sandman!!!

Volker your script nailed it perfectly!!!! Thanks!!

Sandman yours was great too but did not sort according to dates and then clm_cnt, listed all the dates 1st and then started listing all the clm_cnt.

Thanks A lot