Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi there guys. I am not too new to perl, but I am struggling with this as I have limited time (2 hours left) to deadline. I have a flat file of 35mb it contains events that occured. the different areas are seperated by comma's. I have to search for an event id without stripping the string down. That I managed to do by doing this.
$file = 'Events.txt'; open $info, $file; while($line = <$info>) { @get_data = split ',' ,$line; @alert_ID = @get_data[5]; # No need to do this, but showing you + guys where my ID is located and how I find it.

So that is pretty straight forward. The thing now is, I have a 2gb XML file which will have similar alert_ids under tag <ALERT_ID>12345</ALERT_ID> I want to do a search for the @alert_ID in the XML file, if it finds it just say success, however if not found, it should return to the text file, copy the full @get_data string to another file. This way I can see which ID's were not successfully processed. It needs to do it for each ID and there are 900 odd thousand.

This is a 3 line extract of the Text 900 000 line file:

254368,1127,254368,PLMN-PLMN/BSC-396576/BCF-1411,2G_RB_Boardwalk_MN1_K +ZN,13201275,1,0,2,24-01-2013 00:00:04,24-01-2013 02:13:28,system,0,24 +-01-2013 23:56:06,cleanup,7706,1,55753,-1,-1,0,BTS O&M LINK FAILURE,2 +4-01-2013 00:00:04,24-01-2013 00:00:11,,0,,,,FF FF FF FF FF FF,0,1.01 +E+17,0,1.01E+17,1.01E+17,1.01E+17,0,0,24-JAN-13 PM +,0,396576 264616,1127,1127,PLMN-PLMN/BSC-396576/PCM-324,2G_Kwambonambi_KZN,13201 +274,1,0,1,24-01-2013 00:00:04,24-01-2013 02:16:57,system,0,24-01-2013 + 23:56:06,cleanup,2915,1,9760,-1,-1,0,FAULT RATE MONITORING,24-01-201 +3 00:00:04,24-01-2013 00:00:11,,0,,,ET 324d 00 ,,0,1.01E+17,0,1.01E+1 +7,1.01E+17,1.01E+17,0,0,24-JAN-13 PM,0,396576 276160,1130,1130,PLMN-PLMN/BSC-397139/PCM-304,2G_Kingscliffe_Smarket_M +TN_KZN,13201278,1,0,3,24-01-2013 00:00:11,24-01-2013 00:00:52,system, +0,24-01-2013 00:00:56,WITHCANCEL,2909,3,7206,-1,-1,0,AIS RECEIVED,24- +01-2013 00:00:11,24-01-2013 00:00:15,,0,,,ET 304d 00 ,,0,1.01E+17,0,1 +.01E+17,1.01E+17,1.01E+17,0,0,23-JAN-13 PM,0,39713 +9

here is an extract of the XML:


Please, some help would be much obliged!

In reply to Seaching for text in string and comparing to xml, if not found print text by helpneeded

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (12)
    As of 2015-11-25 21:43 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (691 votes), past polls