Hello,
I am trying to capture relevant data from the output of a cmd.
the data I will get in a log is similar to the info below:
JOHNRV3000
Computer Group Policy processing cycle:
STARTED: 13:51:59 on 9/9/2005
FINISHED: 13:52:4 on 9/9/2005
Total elapsed processing time: 0 hours, 0 minutes, 4 seconds and 500 msec.
User Account: jtech Group Policy processing cycle:
STARTED: 14:26:49 on 7/29/2004
FINISHED: 14:26:49 on 7/29/2004
Total elapsed processing time: 0 hours, 0 minutes, 0 seconds and 0 msec.
User Account: Administrator Group Policy processing cycle:
STARTED: 15:41:27 on 11/9/2004
FINISHED: 15:41:27 on 11/9/2004
Total elapsed processing time: 0 hours, 0 minutes, 0 seconds and 265 msec.
User Account: johnrv Group Policy processing cycle:
STARTED: 14:49:4 on 9/9/2005
FINISHED: 14:49:4 on 9/9/2005
Total elapsed processing time: 0 hours, 0 minutes, 0 seconds and 641 msec.
I would like to open the file and have it match the pattern:
Computer Group Policy processing cycle:, if it matches that pattern I want the script to capture the 3 previous lines, the line itself and the 4 following lines. Here is what I have so far:-->
opendir(DIRHANDLE,".");
@filenames = readdir(DIRHANDLE);
@results;
############################################################################
##opens file and parses for pertinent information
open (Daily, "$filenames[3]") || die "Couldn't open file\n";
while (<Daily>) {
foreach ($_) {
if (m/Computer Group Policy processing cycle:/) { SOMEHOW GET PREVIOUS 3 LINES ETC}
}
}
Any help sorting this out would be greatly appreciated.
thanks,
Ben Svobodny
I am trying to capture relevant data from the output of a cmd.
the data I will get in a log is similar to the info below:
JOHNRV3000
Computer Group Policy processing cycle:
STARTED: 13:51:59 on 9/9/2005
FINISHED: 13:52:4 on 9/9/2005
Total elapsed processing time: 0 hours, 0 minutes, 4 seconds and 500 msec.
User Account: jtech Group Policy processing cycle:
STARTED: 14:26:49 on 7/29/2004
FINISHED: 14:26:49 on 7/29/2004
Total elapsed processing time: 0 hours, 0 minutes, 0 seconds and 0 msec.
User Account: Administrator Group Policy processing cycle:
STARTED: 15:41:27 on 11/9/2004
FINISHED: 15:41:27 on 11/9/2004
Total elapsed processing time: 0 hours, 0 minutes, 0 seconds and 265 msec.
User Account: johnrv Group Policy processing cycle:
STARTED: 14:49:4 on 9/9/2005
FINISHED: 14:49:4 on 9/9/2005
Total elapsed processing time: 0 hours, 0 minutes, 0 seconds and 641 msec.
I would like to open the file and have it match the pattern:
Computer Group Policy processing cycle:, if it matches that pattern I want the script to capture the 3 previous lines, the line itself and the 4 following lines. Here is what I have so far:-->
opendir(DIRHANDLE,".");
@filenames = readdir(DIRHANDLE);
@results;
############################################################################
##opens file and parses for pertinent information
open (Daily, "$filenames[3]") || die "Couldn't open file\n";
while (<Daily>) {
foreach ($_) {
if (m/Computer Group Policy processing cycle:/) { SOMEHOW GET PREVIOUS 3 LINES ETC}
}
}
Any help sorting this out would be greatly appreciated.
thanks,
Ben Svobodny