how to split file by two new lines (\n\n) and convert it into array
Input file example:
Status_EventId = ""
Status_NmosSerial = ""
Status_Acknowledged = 0
acknowledgementStatus = "notAck"
additionalText = ""
specificProblems00 = ""
managedobjectInstance00 = "1.3.6.1.4.1.12.2.2.159#1/1.3.6.1.4.1.12.2.2
+.22#1/1.3.6.1.4.1.12.2.2.0#7863"
perceivedSeverity = "warning"
neLocationName = ""
currentAlarmId = "8557984"
lastOccurence = "1408338405832"
acknowledgementUserName = ""
additionalInfo00 = "RMServiceState =inService"
additionalInfo01RMObjectType = "path"
notificationType = "alarmRaise"
remoteHost = "/10.23.13.153:25061"
eventType = "communicationsAlarm"
eventTime = "20140818050641"
ASid = "3"
firstOccurence = "1408338405832"
probableCause = "Client Failure"
reservationStatus = "notReserved"
friendlyName = "B_GSM-R_N0a.12_N11BSC2.01"
RawCaptureTimeStamp = 1408338405
Status_EventId = ""
Status_NmosSerial = ""
Status_Acknowledged = 0
currentAlarmId = "8557984"
lastOccurence = "1408338448373"
notificationType = "alarmClear"
remoteHost = "/10.23.13.153:25061"
eventTime = "20140818050723"
ASid = "3"
firstOccurence = "1408338448373"
probableCause = "Client Failure"
friendlyName = "B_GSM-R_N0a.12_N11BSC2.01"
RawCaptureTimeStamp = 1408338448
Status_EventId = ""
Status_NmosSerial = ""
Status_Acknowledged = 0
acknowledgementStatus = "notAck"
additionalText = ""
specificProblems00 = ""
managedobjectInstance00 = "1.3.6.1.4.1.12.2.2.159#1/1.3.6.1.4.1.12.2.2
+.22#1/1.3.6.1.4.1.12.2.2.69#711/1.3.6.1.4.1.12.2.2.70#13258/1.3.6.1.4
+.1.12.2.2.106#1057529"
perceivedSeverity = "major"
neLocationName = ""
currentAlarmId = "8557985"
lastOccurence = "1408338596741"
acknowledgementUserName = ""
additionalInfo00 = "RMServiceState =notInService"
additionalInfo01RMObjectType = "lo-hotrail"
notificationType = "alarmRaise"
remoteHost = "/10.23.13.153:25061"
eventType = "communicationsAlarm"
eventTime = "20140818050646"
ASid = "3"
firstOccurence = "1408338596741"
probableCause = "Transport Failure"
reservationStatus = "notReserved"
friendlyName = "Trail_S42.3_S42.6_01"
RawCaptureTimeStamp = 1408338596
Output data format should be as below:
additionalInfo00,notificationType,eventType,friendlyName
"RMServiceState =notInService","alarmRaise","communicationsAlarm","Tra
+il_S42.3_S42.6_01"
The output file should has header and then data from the input file.
I am not able to split file into array and assign vlaues to the keys in desired format.
Kindly help me
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.