How do I spin through a logfile?

Find, replace, find in files, replace in files, regular expressions

How do I spin through a logfile?

Postby ssmith001 » Tue Aug 15, 2006 5:14 pm

I have a logfile that looks like this:

Code: Select all
12:03:24       20039 DIF has 866 recs, ACK reports 8529
12:03:24       20039 GetDIF was unsuccessful
12:03:24       20039 End processing 20039

12:03:26    20040 DIF has 1443 recs, ACK reports 5966
12:03:27    20040 GetDIF was unsuccessful
12:03:27    20040 End processing 20040


I need a way to look at each line, looking for "End processing" and then return the 5 digit number after each of these.

How can I do this?
User avatar
ssmith001
Newbie
 
Posts: 4
Joined: Thu Dec 01, 2005 12:00 am

Re: How do I spin through a logfile?

Postby Mofi » Wed Aug 16, 2006 5:27 am

What do mean with return the 5 digit number?

Should the number be highlighted, copied to clipboard, copied to a new file, ...?
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How do I spin through a logfile?

Postby ssmith001 » Wed Aug 16, 2006 2:44 pm

In my example, I need to grab the 20039 and the 20040, and put them in a new file. Sometimes the data "12:03:27 20040 End processing 20040" will be offset by about 6 characters, as in this example:

Code: Select all
13:30:48                35050 [PerformanceMeasurement3] starting
13:30:48                35050 27355 released stream
13:30:48                35050 End processing 35050

13:30:48       20021 27448 got stream after waiting 0:24:58
13:30:48       20021 [ZeroSOF_S] dealer 20021 day is sa, sofwday is tu, zeroS is 0
13:30:48       20021 [ParseDIF] Parsing 2002108152006.DIF
13:30:49 00235 [PerformanceMeasurement3] starting
13:30:49 00235 27206 released stream
13:30:49          20001 27389 got stream after waiting 0:24:58
13:30:49 00235 End processing 00235
User avatar
ssmith001
Newbie
 
Posts: 4
Joined: Thu Dec 01, 2005 12:00 am

Re: How do I spin through a logfile?

Postby Mofi » Thu Aug 17, 2006 5:13 am

Run an UltraEdit style Regular Expressions search with search string %*End processing +[0-9]+ and with List Lines Containing String enabled. You will see a dialog which contains all lines of interest.

Click in the dialog on the button Clipboard and close the dialog. Create a new file and paste the lines with Ctrl+V.

Press Ctrl+Home to move the cursor to top of the new file and run following UltraEdit style Regular Expressions Replace to delete the part before the numbers of interest.

Find: %*End processing +
Replace: with nothing
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How do I spin through a logfile?

Postby ssmith001 » Thu Aug 17, 2006 6:51 pm

Thanks a lot. For some reason, when I go to paste the results copied from the find, there are no records, even though the find return some.
User avatar
ssmith001
Newbie
 
Posts: 4
Joined: Thu Dec 01, 2005 12:00 am

Re: How do I spin through a logfile?

Postby ssmith001 » Thu Aug 17, 2006 7:05 pm

That's odd. I exited UE and came back in and now I can paste. Oh well, on the second expression, I get the following output:

12:11:20 35204 35204
12:11:27 42120 42120
12:12:03 25188 25188
12:13:33 20184 20184
12:14:31 20167 20167
12:14:54 20065 20065
12:15:44 20044 20044
12:15:55 20042 20042
12:16:15 20013 20013
12:16:46 20005 20005

All I want is the number
User avatar
ssmith001
Newbie
 
Posts: 4
Joined: Thu Dec 01, 2005 12:00 am

Re: How do I spin through a logfile?

Postby Mofi » Fri Aug 18, 2006 5:15 am

Looks like you do not use the UltraEdit style regular expression engine because this result is produced by the Unix or Perl engine with the UE regular expressions - see Configuration - Search dialog.

For Unix or Perl use following search strings:

Find search string: ^.+End processing +\d+
Replace search string: ^.+End processing +
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions