Reputation: 275
The following code used to work:
my $matchExpr = "User created at \(UserIndex\) UserId = ";
my @indexLine = grep /\Q$machExpr/, <LOGFILE>;
...
my $indexId = $indexLine[0];
$indexId =~ s/\Q$matchExpr//;
chomp $indexId;
with a LOGFILE containing the line:
"User created at UserIndex UserId = "
However, the LOGFILE format changed to this:
"2017-01-01 08:50:22 User created at UserIndex UserId ="
and the code won't work anymore. Looking for a quick fix as no one here knows Perl.
Thanks.
Upvotes: 0
Views: 51
Reputation: 386331
Replace
$indexId =~ s/\Q$matchExpr//;
with
$indexId =~ s/^.*?\Q$matchExpr//;
Or replace the entire thing with the following:
my ($indexId) = grep /User created at \(UserIndex\) UserId = (.*)/, <LOGFILE>;
Upvotes: 2