Hi all, I'm really at my wits end already. I can't seem to figure out how to import a text file that has no delimiters or common field widths.
Basically, I have a text file containing events that happened to a system over the month. I need to somehow create a table to store all the details in it.
I can't change the text file as the program that generates it only does it this way. However, the program made it such that every 6 lines is a record, meaning the details of 1 event is stored within every 6 lines.
A sample of the text file is given below:
The sample shows 2 records/events.
If the line contains "ES", it's the start of a record/event.
I need to insert into the database the date (first line), the admin acknowledge (third line), the details (fifth line) and the event name (sixth line).
Basically, I have a text file containing events that happened to a system over the month. I need to somehow create a table to store all the details in it.
I can't change the text file as the program that generates it only does it this way. However, the program made it such that every 6 lines is a record, meaning the details of 1 event is stored within every 6 lines.
A sample of the text file is given below:
Code:
ES~1~1412179200(Oct 02 00:00:00 2014)~1~ITM_W64MQMONITORLOG00~ ITM~W01XXASPAXX1B:W6400~12.34.56.78~~W01XXASPAPP1B~W01XXASPAXX1B~ACK~ Danny~[ admin]~WARNING~ 10/01/2014~ WAR_umW64_MQMOXXXORLOG[(STRSCAN(Logline, "CURDEPTH") = 1 ) OR ( ST=1 OR STRSCAN(Logline, "STATUS") = 1 ) ) ;W642=1 ) ON W01GGASXXXX1B:W6400 (Logline= CURDEPTH(4642) )]~ CORE_INFRA~0~ 0~0~ES~1~1412179203(Oct 02 00:00:03 2014)~1~ITM_Log_Entries~ ITM~a01gibestmtrep2a:KUL~12.34.56.78~~a01gibesxxxrep2a~a01gibxxxmtrep2a~ACK~ Karthi~[ admin]~WARNING~ 10/02/2014~ WAR_ulGIBESTXXXEP_EADVICE_XXX[(Log_Path="/estmtrephk/ibrhk/eSRBatch/logs/" AND Log_Name="eaxxxceSchedule.log" AND STRSCAN(Descrxxxion_U, N"dir=/usr/java6/jre/lib/ext") = 1 ;XXXOGENT.ENTR=1 ) ON a01gibxxxmtrep2a:KUL (Log_Path=/estxxxephk/ibxhk/exxxxxch/logs/ Log_Name=eadvixxXedule.log Description_U=dir=/usfssr/javaaa6/jreasdfsa/lib/ext )]~ APPS~0~
If the line contains "ES", it's the start of a record/event.
I need to insert into the database the date (first line), the admin acknowledge (third line), the details (fifth line) and the event name (sixth line).
Comment