I have an archive file (PIDATA) that contains multiple (>30) segments of text like this:
The program repeats this over and over, naming each segment "Archive[1,2,3..]" and I need to extract the bold sections, and print them on one line... for example, I'd like THIS:
Archive[0]: d:\archives\pia rch.012 (500MB, Used: 9.0%) ..... Start Time: 1-Apr-08 22:02:38 ..... End Time: Current Time
ALL on one line.
Here's my PERL script, but it doesn't seem to work.
[CODE=perl]#!/usr/bin/perl
while(<PIDATA>) {
if (m/Archive.[\d+].*/) {
$m1 =~ "$MATCH";
}
if (m/Start\sTime.*/) {
$m2 =~ "$MATCH";
}
if (m/End\sTime.*/) {
$m3 =~ "$MATCH";
}
print "$m1 \s $m2 \s $m3\n\n";
}
[/CODE]
I tried to loop over the text file, and redirect the output, but the file is empty after running this.
HELP!
Code:
[b]Archive[0]: d:\archives\piarch.012 (500MB, Used: 9.0%)[/b]
PIarcfilehead[$Workfile: piarfile.cxx $ $Revision: 114 $]::
Version: 5 Path: d:\archives\piarch.012
State: 4 Type: 0 (fixed) Write Flag: 1 Shift Flag: 1
Record Size: 1024 Count: 512000 Add Rate/Hour: 4118.3
Offsets: Primary: 25853/128000 Overflow: 491596/512000
[B]Start Time: 1-Apr-08 22:02:38[/B]
[B]End Time: Current Time[/B]
Backup Time: 2-Apr-08 02:01:07
Archive[0]: d:\archives\pia rch.012 (500MB, Used: 9.0%) ..... Start Time: 1-Apr-08 22:02:38 ..... End Time: Current Time
ALL on one line.
Here's my PERL script, but it doesn't seem to work.
[CODE=perl]#!/usr/bin/perl
while(<PIDATA>) {
if (m/Archive.[\d+].*/) {
$m1 =~ "$MATCH";
}
if (m/Start\sTime.*/) {
$m2 =~ "$MATCH";
}
if (m/End\sTime.*/) {
$m3 =~ "$MATCH";
}
print "$m1 \s $m2 \s $m3\n\n";
}
[/CODE]
I tried to loop over the text file, and redirect the output, but the file is empty after running this.
HELP!
Comment