Answer to Question #12657 in Perl for sam

Question #12657
print "Please enter the file URL:";
$PnpLogPath = <>;

print "Please enter the Device URI: ";
$DeviceURI = <>;

open(HANDLE, $PnpLogPath);
@LogInput = < HANDLE >;

@subarray = grep /\Q$DeviceURI\E/, @LogInput;
foreach $subarray(@subarray)
{
print $subarray."\n";
}
I have a logfile say logfile.txt which contains info. I am passing name of file from command line and also the word which I want to find through command line and print those lines which contains that word. But somehow grep is not returning the line which contains it. HElp me out here.

The word which I am trying to find is --https://sn1.notify.Sunday,.net/unthrottSeaTacJFKInternational/01.00/AAHdC--PWgJuTrmAX1A3jeoyAgAAAAADAQAX1AQUZm52OkJCMjg1QTQ

The logFile is :

2012-07-25 18:31:30,788 access INFO request accepted. Request: , URI:https://sn1.notify.Sunday,.net/unthrottSeaTacJFKInternational/01.00/AAHdC--PWgJuTrmAX1A3jeoyAgAAAAADAQAX1AQUZm52OkJCMjg1QTQ**, Payload:

2012-07-25 18:31:30,859 root INFO insert req into server queue 2012-07-25 18:31:30,861 root DEBUG start consume requests from server queue [sn1.notify.Sunday,.net]

2012-07-25 18:31:30,862 root INFO try sending more requests. requests in queue: 688

2012-07-25 18:31:31,331 access INFO request accepted. Request: , URI:https://sn1.notify.Sunday,.net/unthrottSeaTacJFKInternational/01.00/AAFVBNQ4MAySQK-rDr0-CmOvAgAAAAADAQrDr0QUZm52OkJCMjg1QTQ, Payload:
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS