Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://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 09.56.10.484000000 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 09.56.10.488000000 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 10.00.56.328000000 PM,0,39713 +9

here is an extract of the XML:

<MF_NOTIF_IND> <DOMAIN>NARANTC</DOMAIN> <RELEASE>R1</RELEASE> <OMC>158</OMC> <MOC> <MOCEntry value="PPTT"/> </MOC> <MOI> <RDN id="PLMN" value="PLMN"/> <RDN id="RNC" value="705"/> <RDN id="WBTS" value="38142"/> <RDN id="FTM" value="1"/> <RDN id="PPTT" value="1-1"/> </MOI> <EVENTTYPE>COMMUNICATIONS_ALARM</EVENTTYPE> <EVENTTIME>20130123235946</EVENTTIME> <EVENTINFO> <ProbableCause> <Value>INDETERMINATE</Value> </ProbableCause> <SpecificProblems> <SpecificProblemsItem> <Value>61152</Value> </SpecificProblemsItem> </SpecificProblems> <PerceivedSeverity>MAJOR</PerceivedSeverity> <NotificationIdentifier>21733559</NotificationIdentifier> <AdditionalText>RDI on unit 1 interface 1.</AdditionalText> <AdditionalInfo/> <UserAdditionalInfo/> <DiagnosticInfo>EMPTY</DiagnosticInfo> <ALARM_ID>21733559</ALARM_ID> <COMMENTS>CEN RAN</COMMENTS> <BACK_UP_OBJECT>3G_BE05_BES_CEN</BACK_UP_OBJECT> <BACKED_UP_STATUS>38142-Eiland_CEN</BACKED_UP_STATUS> <MONITORED_ATTRIBUTES/> <ALARM_LIST_ALIGNMENT_REQUIREMENT>EMPTY</ALARM_LIST_ALIGNMENT_REQU +IREMENT> <SERVICE_USER>EMPTY</SERVICE_USER> <SERVICE_PROVIDER>EMPTY</SERVICE_PROVIDER> <SECURITY_ALARM_DETECTOR>EMPTY</SECURITY_ALARM_DETECTOR> <STATE_CHANGE_DEFINITION>EMPTY</STATE_CHANGE_DEFINITION> <VENDOR_SPECIFIC_ALARM_TYPE>EMPTY</VENDOR_SPECIFIC_ALARM_TYPE> <ACK_TIME>EMPTY</ACK_TIME> <ACK_SYSTEM_ID>EMPTY</ACK_SYSTEM_ID> <ACK_USER_ID>EMPTY</ACK_USER_ID> <ACK_STATE>EMPTY</ACK_STATE> <THRESHOLD_INFO>24745</THRESHOLD_INFO> <TREND_INDICATION>EMPTY</TREND_INDICATION> <STATE_CHANGE_DEFINITION>EMPTY</STATE_CHANGE_DEFINITION> <PROPOSED_REPAIR_ACTIONS>EMPTY</PROPOSED_REPAIR_ACTIONS> <CORRELATED_NOTIFICATIONS>EMPTY</CORRELATED_NOTIFICATIONS> <REASON>EMPTY</REASON> <CLEAR_USER_ID>EMPTY</CLEAR_USER_ID> <CLEAR_SYSTEM_ID>EMPTY</CLEAR_SYSTEM_ID> <SYSTEM_DN>SubNetwork=Nokia-1,ManagementNode=OMC-1,IRPAgent=1</SYS +TEM_DN> </EVENTINFO> <USERLABEL>1-1</USERLABEL> <EventFeed>NARANTC</EventFeed> </MF_NOTIF_IND>

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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-28 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found