here is my code and my reg ex:
<?php
$f = fopen ("LowLevelLogs.txt", "r");
$ln= 0;
while ($line= fgets ($f)) {
++$ln;
//printf ("%2d: ", $ln);
if ($line===FALSE) {
echo ("FALSE\n");
}
else {
if (preg_match("/TEST/", $line, $matches)) {
echo $matches[0]."<br>";
}
}
}
fclose ($f);
?>
the problem is that i want to print the whole line that matches the reg ex.
Here is the text file:
12-31-1969-04:00:00
MTEST=================
12-31-1969-04:00:00
MTESTSTART OF VPN TEST
12-31-1969-04:00:00
MTEST=================
12-31-1969-04:00:00
MTESTConfiguring MPLS Core Devices
12-31-1969-04:00:00
MTESTConnect to 172.24.1.61
12-31-1969-04:00:00
MTESTConfiguring MPLS Protocol
12-31-1969-04:00:00
MINFOset protocols mpls interface ge-3/2/0
12-31-1969-04:00:00
MINFOset protocols mpls interface ge-3/3/0
12-31-1969-04:00:00
MINFOset protocols mpls interface lo0
12-31-1969-04:00:00
MTESTConfiguring Interfaces
12-31-1969-04:00:00
MTESTConfiguring Interface ge-3/2/0
12-31-1969-04:00:00
MINFOset interfaces ge-3/2/0 enable
12-31-1969-04:00:00
MINFOset interfaces ge-3/2/0 unit 0
12-31-1969-04:00:00
MINFOset interfaces ge-3/2/0 unit 0 family mpls
12-31-1969-04:00:00
MINFOset interfaces ge-3/2/0 unit 0 family inet address 10.1.1.1/30
12-31-1969-04:00:00
MTESTConfiguring Interface ge-3/3/0
is it possible to store each line into <div>?
<?php
$f = fopen ("LowLevelLogs.txt", "r");
$ln= 0;
while ($line= fgets ($f)) {
++$ln;
//printf ("%2d: ", $ln);
if ($line===FALSE) {
echo ("FALSE\n");
}
else {
if (preg_match("/TEST/", $line, $matches)) {
echo $matches[0]."<br>";
}
}
}
fclose ($f);
?>
the problem is that i want to print the whole line that matches the reg ex.
Here is the text file:
12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

12-31-1969-04:00:00

is it possible to store each line into <div>?