How can i make a report from some insert in UNIX shell?

I have some insert in my unix shell script. This every insert has a spool (a file with datas) and a sql file with the query. I have to create a report file with three columns:
The first(TAB_NAME) will contains the name of the table in wich has been done the insert, the second (STATE) will contains if there is a dupkey or not and the last (RECORDS) will contains the number of insert record. So i suppose that i have to make a `SELECT COUNT` after the insert right? How can i do the report? The structure of the report (a file):

    TAB_NAME  |  STATE  | RECORDS
    ------------------------------
      TAB1    |  DUPKEY |    25
      TAB2    |  DUPKEY |    50

Something like this. Thanks

What have you tried so far?

I don't know how start.. How can i create for example the structure of the file? I tried with a

echo "|   TAB_NAME    |   STATE  |  RECORDS  |"  >> ${REPORT}

So in this way i have the report file in the three columns (I don't think is the best way). And now i'm stuck.. I have 3 insert.. So 3 tables. Every insert has a spool in wich there are the datas like this example:

;@05068353056;@652483854191654146502;@5*;@AS;@230-JUN-13 06.50.35.000000 AM;@50757355612187;@DKQFSR;@730-JUN-10;@830-JUN-10

;@05068693256;@652483854191587446502;@5*;@AS;@230-JUN-13 06.50.35.000000 AM;@50757355612187;@DKSGSR;@730-JUN-10;@830-JUN-10

But what i want is not display the whole datas but only how many records are insert.. And the name of the table

What are the data you want to extract from each line?

say you have below line now what all you want to extract and display?

What you can see from my first post.

I cant see any of the below fields in your records..

  TAB1    |  DUPKEY |    25
  TAB2    |  DUPKEY |    50

I know. But what i mean is how can i create a file like this? A kind o table i mean.. Is there some specific command?

There is no specific command to create table in unix.. If you know which all the fields to take out from the input file to form the table then we can use awk to create a table like structure :slight_smile: