hi,
I have one array with 2 Strings:
String1: "REMOTE [Mon Jul 16 21:49:33 2012] @@ [ueh1] [TNT] [2049
+0] [1916] 0.0- 1.0 sec 0.33 MBytes 2.74 Mbits/sec 6.056 ms 0/
+ 233 (0%)".
String2: "REMOTE [Mon Jul 16 21:49:34 2012] @@ [pdn1] [SSH] [2049
+9] [3] 1.0- 2.0 sec 0.34 MBytes 2.86 Mbits/sec".
In "String1" I have two extra values that is "6.056 ms"
and "0/ 233 (0%)" rest are same in both string;
I tried this regex:
m/^REMOTE\s+\[(.*?)\]\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+\[(.*?)\]\s+(.*?)sec\s+(.*)MBytes\s+(.*)Mbits\/sec but need to add the above mentioned two values of String1 in regex and make them optional so that both condition gets passed and last values stored in $10, $11.
Can anyone help me?
Thanks in advance
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.