Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Perl Regular Expression Issue

by NetWallah (Canon)
on Sep 08, 2015 at 01:00 UTC ( [id://1141289]=note: print w/replies, xml ) Need Help??


in reply to Perl Regular Expression Issue

Here is a one-liner to get you started:
perl -E 'my ($datetime, $mpnum, $msisdn) = $ARGV[0]=~/^([\d\-]+\s[\d:,]+).+\[MP(\d{14})\].+msisdn\s:\s(\d+)/; say for ($datetime,$mpnum,$msisdn)' '2015-03-27 20:39:49,796 ERROR MPesa 7002 webServices 10.201.12.200- [ +MP27203801969209][301a8a0e-bb59-4182-9a4b-79abbb3ed39a][payBillRechar +geAllOperator][McomSendSMSServ­iceImpl][callSpiceSMSApi] - Exit Metho +d with status Map : {smsFlag=true, errorMsgs=null, status=SUCCESS} fo +r msisdn : 9431641426' __Output__ 2015-03-27 20:39:49,796 27203801969209 9431641426

        Clarity: it's like that one thing that is not the other thing, except for when it is.

Replies are listed 'Best First'.
Re^2: Perl Regular Expression Issue
by Anonymous Monk on Sep 08, 2015 at 10:52 UTC

    Thanks a lot for the help. It worked!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1141289]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found