1846188 Members
3415 Online
110254 Solutions
New Discussion

PERL script to parse

 
SOLVED
Go to solution
Dodo_5
Frequent Advisor

PERL script to parse

Hi,
I have attached one report file.the output pattern also i have attached.I want to parse the starting location values & corresponding % cpu Solo time.
Can anyone please help in this regard?
7 REPLIES 7
Hein van den Heuvel
Honored Contributor
Solution

Re: PERL script to parse


That zip file is small and unuseable (for me).

Maybe just attach a simple .txt file with a good chunk of input data and some sample output.

'starting location' and 'Solo' time do not mean much to me now, but might become clear if the data had been readable.

Please show us how far you got with trying to solve this, or send money for us to do all your work

hth,
Hein.
James R. Ferguson
Acclaimed Contributor

Re: PERL script to parse

Hi:

It seems that this file (attachment) is corrupt. At least, I can't open it.

Regards!

...JRF...
Dodo_5
Frequent Advisor

Re: PERL script to parse

First of all,sorry for attaching a corrupt file.
I am attaching it again.
I have used awk $3 inputfile>output
but the output is not comin properly.I think some column mismatch is also happening.So asking for your help.
Steven Schweda
Honored Contributor

Re: PERL script to parse

> That zip file is small and unuseable (for
> me).

It is small, but I had no trouble with it.
(Mozilla/5.0 (X11; U; OpenVMS
COMPAQ_Professional_Workstation; en-US;
rv:1.7.13) Gecko/20060506 + UnZip 5.52).
Perhaps you live wrong.

alp $ unzip -t 308587.ZIP
Archive: ALP$DKA0:[SMS.ITRC]308587.ZIP;1
testing: New Folder/Input file.txt OK
testing: New Folder/output.xls OK
testing: New Folder/ OK
No errors detected in compressed data of ALP$DKA0:[SMS.ITRC]308587.ZIP;1.

The ".xls" file was pretty useless to me, of
course.
James R. Ferguson
Acclaimed Contributor

Re: PERL script to parse

Hi (again):

Perhaps:

# perl -ne 'next if m{^\s*$};@a=split;next unless $a[0]=~m{[0-9A-F]+} && $a[2]=~m{\d*\.\d+} && printf "%s %s\n",$a[0],$a[2]' file

Regards!

...JRF...
Dodo_5
Frequent Advisor

Re: PERL script to parse

thanks for that...
but can you help in that script?
Hein van den Heuvel
Honored Contributor

Re: PERL script to parse


JRF choose for a solution where he skips (next) lines if they do not match.

I prefer to look for what I need:

$ perl -lne 'print qq($1 $2) if /^\s+([0-9A-F]{6})\s+\d+\s+([0-9.]+)/' file

Regular expression par # explanaiton

^\s+ # a line starting with some whitespace
([0-9A-F]{6}) # and 6 hex character (remember in $1)
\s+\d+\s+ #followed by whitespace, number, whitesdpace
([0-9.]+) # and finally some numbers or dots, remembered in $2.

If the line matches that, then print those $1 and $2 remembered.

hth,
Hein.