Extract block of data and the error reason too. So so urgent


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extract block of data and the error reason too. So so urgent
# 1  
Old 07-23-2009
Bug Extract block of data and the error reason too. So so urgent

Hi , this is my first enty in our forum.

Problem scenario:

Using informatica tool am loding records from source DB to target DB. While loading some records getting rejected due to some reason. Informatica will capture those rejected records in session log file.now the session log ll be available with rejected records and the reason for the rejection as below
Code:

Code:
this is the reason for the error
ORA-12899: value too large for column "STN"."STN_SAP_MATERIAL_ATTR"."SMA_STD_DESCR" (actual: 19, maximum: 18)
.
.
.
these are the values for the rejected row:
2009-07-09 15:38:23 : INFO : (5439 | WRITER_1_*_1) : (IS | UDEV811_2_IS) : NDIP_DEV_811_N1 : CMN_1053 : : Rowdata: ( RowType=0(insert) Src Rowid=129406 Targ Rowid=129406
SMA_NET_WEIGHT (SMA_NET_WEIGHT:Double:): "0.001"
SMA_UNIT_OF_WT (SMA_UNIT_OF_WT:UniChar.3:): "KG"
SMA_VOLUME (SMA_VOLUME:Double:): "0.001"
SMA_VOLUMEUNIT (SMA_VOLUMEUNIT:UniChar.3:): "M3"
SMA_EANUPC (SMA_EANUPC:UniChar.18:): ""
SMA_IND_SECTOR (SMA_IND_SECTOR:UniChar.1:): "A"
SMA_BASE_UOM (SMA_BASE_UOM:UniChar.3:): "ST"
SMA_COMPETITOR (SMA_COMPETITOR:UniChar.10:): ""


)
...........unwanted details.....again above mentioned things ll come.

between both the required details , some not required data also there.
We can read the reason for the rejection using the value
ORA- or the tablename mentioned in the same line.
we can jump to the row value details using the keyword Targ Rowid and from next line we can get the values for each fields and should read the values till the close bracket ")".
I have to loop through the whole session log file to get all the rejected rored with reason. and i want the rejection reason and the values in single row and next record's rejection reason and values in next line ... an so on , in new file.

shell script is preferable. its as ur wish. but give me a sloution


Plz plz help me on this...

Last edited by jim mcnamara; 07-23-2009 at 08:41 AM..
# 2  
Old 07-23-2009
Try and adapt the following code :
Code:
awk '
   /^ORA-/ {
      if (Text) print Text;
      Text = "------------\n" $0;
      next;
   }
   /Targ Rowid/ {
      Values = 1;
      next;
   }
   /^)/ {
      Values = 0;
      next;
   }
   Values {
      Text = Text "\n" $0
   }
   END {
      if (Text) print Text;
   }

    ' inputfile

Jean-Pierre.
# 3  
Old 07-23-2009
Lovely !!!!!

Pierre its working Pierre !!!!! i was pulling my hair for this..

but can u plzzzzzz explain each line what its doing..
becaze am not much aware abt AWK script dude Smilie


Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

Urgent : Extract Pattern

Hi All, I need ot extrat initial from a file name coming. For example i have a file TOOL_Test_File1_AK.txt i need to extract string AK from it that will come prior to .txt other examples TOOL_Test_File1_AKA.txt------ output should be AKA TOOL_Test_File1_KASD.txt------ output KASD... (1 Reply)
Discussion started by: Arun Shukla
1 Replies

2. Emergency UNIX and Linux Support

Urgent help pls.how to extract two lines having same starting number

Hi , I have a huge file like this =245 this is testing =035 abc123 =245 this is testing1 =035 abc124 =245 this is testing2 =035 abc125 =035 abc126 =245 this is testing3 here i have to pull out those lines having two =035 instead of alternative 035 and 245 i.e extract... (18 Replies)
Discussion started by: umapearl
18 Replies

3. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

4. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

5. Shell Programming and Scripting

URGENT:- Data Scrubbing

Hi All, I have a Flatfile (any delimitation) of millions of lines of data, where in i have to scrubb the data of the line from the position ($1 ) given in input parameter until the length ($2) given in the input parameter. I utilised awk , sed but i am unable to do it. scrub key - 12345... (7 Replies)
Discussion started by: padhu.47
7 Replies

6. Shell Programming and Scripting

extract data from a data matrix with filter criteria

Here is what old matrix look like, IDs X1 X2 Y1 Y2 10914061 -0.364613333 -0.362922333 0.001691 -0.450094667 10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies

7. Shell Programming and Scripting

why my script stopped- any reason(urgent please)

Hi Friends, iam running some scripts, which are all off suddenly stopping. Can any one tell me the reason why it happend. Is there any reason to stop the scripts. Thanks Krishna. (1 Reply)
Discussion started by: krishna9
1 Replies

8. Shell Programming and Scripting

urgent-extracting block data from flat file using shell script

Hi, I want to extract block of data from flat file. the data will be like this start of log One two three end of log i want all data between start of log to end of log i.e One two three to be copied to another file. This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies

9. Shell Programming and Scripting

[urgent need help]compare data

hi all, very need help urgently :( i have a problem compare 2 files from solaris, the 2 files its shown below: data1.log : 6512345678 6512345677 20070131 073824 420 6511111111 6522222222 20070131 103747 87 6522222222 6233333333 ... (2 Replies)
Discussion started by: bucci
2 Replies

10. UNIX for Dummies Questions & Answers

extract some specific text file urgent pls

i have a big text file . i want to create new file as extract some specific text from the big file i am using hp ux please help (2 Replies)
Discussion started by: reyazan
2 Replies
Login or Register to Ask a Question