I have a text file with the following type of content:
OPERATION_CONTEXT VMD1HTE1A71_ns:.oc.GJ_OAD2 alarm_object 1130
On director: VMD1HTE1A71_ns:.temip.VMD1HTE1A71_director
AT Fri 18 Oct 2013 06:56:39 All Attributes
Identifier = 1130
State = Terminated
Problem Status = Closed
Clearance Report Flag = True
Escalated Alarm = False
Close User Identifier = "Auto-Clear"
Termination User Identifier = "Auto-Clear"
Close Time Stamp = Fri 18 Oct 2013 05:01:46
Termination Time Stamp = Fri 18 Oct 2013 05:01:46
Creation Timestamp = Fri 18 Oct 2013 04:37:29
Clearance Time Stamp = Fri 18 Oct 2013 05:01:40
Last Modification Timestamp = Fri 18 Oct 2013 05:01:46
Previous State = Outstanding
Managed Object = Alcatel_5529OAD VMD1HTE1A71_ns:.OAD2 MD "AMS" Node "INGJJMGRJMTSNB0001AG2OLT001"
Target Entities = { Alcatel_5529OAD VMD1HTE1A71_ns:.OAD2 MD "AMS" Node "INGJJMGRJMTSNB0001AG2OLT001" }
Alarm Type = CommunicationsAlarm
Event Time = Fri 18 Oct 2013 05:01:40
Probable Cause = Unknown
Specific Problems = { }
Notification Identifier = 160315
Domain = Domain VMD1HTE1A71_ns:.dm.GJ_OAD2
Alarm Origin = IncomingAlarm
Perceived Severity = Major
Additional Text = "
nativeProbableCause: Attempt Threshold Crossed
osTime: 20131018163727.250+0530
neTime: 20131011174021.0+0530
notificationId: AMS:160315
portNumber:
ftpNumber:
meNm: INGJJMGRJMTSNB0001AG2OLT001
mdNm: AMS
objectType: OT_MANAGED_ELEMENT
aliasValue: MGMT Security
Access:INGJJMGRJMTSNB0001AG2OLT001:IP10.70.6.6.T0.S841 "
Original Severity = Major
Original Event Time = Fri 11 Oct 2013 05:40:21
I want to create a CSV file from this text file with Column headers as the values before = in each line like Identifier, State, Problem Status and all the next lines containing the values under each Column header like 1130, Terminated, Closed etc. Apart from the lines with "=" i don't want anything else to be extracted into the CSV file.
Another complication i faced in this is, some fields have a new line character like Additional Text. I want to get all the value for Additional Text in one column under Additional Text Column.
Since i am new to Linux/Unix, i am not able to find a way to do this. What is the best way to do this?