regex - How to extract a part of line in perl -
I would like to know how to extract a part of a line from a file in Perl. I have a log file from which I want to remove some meaningful information through a Perl script. I was able to get the full line I was looking for, but I only want one part of that line.
Perl script (I used): Input file: Output: desired output: team, please ur valuable suggestions to get your free moment! ... It is always based on input your input is not well formatted (not fixed) Length, not CSV) to be the easiest Regedix method.
#! Use / usr / bin / perl strict; Use warnings; My $ file = 'F: \ 3Np_RoboSitter \ perl pgm \ input.txt'; Open your $ FH, "$ lt;", $ file or $$! Print "************************************************************************************************** ************************************************************************************************ ******** \ n "; Print "DC status: \ n \ n"; While (& lt; $ fh & gt;) {Print / DC message / / / DC messages selected from Qualified; } Print "\ n ******************************************************************************* ************************************************************************************************* ************************************ "; Closed ($ FH);
adfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadfafafafqdrareeaf 2014-02-14 00: 18: 04,840 1754897056 INFO Application Services aadfafa123 Application Services Service ApplicationDateCustomerID ApplicationServiceSessionToken XML of Pars started. | Hostname = AAAAAA | Timestamp = 2014-02-14 00: 16: 39.044 | Message = out; SubmitApplications.SubmitApplicationBatchProcess; Total 1311 DC messages were selected from the queue. Extension = & lt; XMLNSC & gt; & Lt; LogMessage & gt; & Lt; MessageText>. A total of 1311 DC messages were taken from the queue. & Lt; / MessageText> gt; & Lt; / Logmessage & gt; & Lt; / XMLNSC & gt; dafafafzcvzvsfdfafafffffffffffffffffffffffff
************************** ***************** DC status: 2014-02-14 00: 18: 04,840 1754897056 INFO ApplicationService Aidfafa 123 began parsing the Anupryogsewayrssewa Kstmraidi Anupryogsewasesesotiotikaksaksaksaks. | Hostname = AAAAAA | Timestamp = 2014-02-14 00: 16:. 39.0 44 Message = out; SubmitApplications.SubmitApplicationBatchProcess; Total 1311 DC I selected from the queue ssages | Extension = & lt; XMLNSC & gt; & Lt; LogMessage & gt; & Lt; Message text & gt; A total of 1311 DC messages were taken from the queue. & Lt; / MessageText> gt; & Lt; / Logmessage & gt; & Lt; / XMLNSC & gt; **************************************************************************************************** *********
2014-02-14 00:18:04 Total 1311 DC message queue. * Provide (that & lt; messagetext & gt; between the tags) *
while (my $ line = <$ fh> gt;) {my ($ date)) = partition (/, /, $ line, 2); If ($ line = ~ s!
Comments
Post a Comment