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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i make a report from some insert in UNIX shell?
# 1  
Old 07-09-2013
Question 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):

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

Something like this. Thanks
# 2  
Old 07-09-2013
What have you tried so far?
# 3  
Old 07-09-2013
Quote:
Originally Posted by vidyadhar85
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
Code:
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:

Code:
;@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
# 4  
Old 07-09-2013
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?
Quote:
;@05068353056;@652483854191654146502;@5*;@AS;@230-JUN-13 06.50.35.000000 AM;@50757355612187;@DKQFSR;@730-JUN-10;@830-JUN-10
# 5  
Old 07-09-2013
Quote:
Originally Posted by vidyadhar85
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.
# 6  
Old 07-10-2013
I cant see any of the below fields in your records..

TAB1 | DUPKEY | 25
TAB2 | DUPKEY | 50
# 7  
Old 07-10-2013
Quote:
Originally Posted by vidyadhar85
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help on Oracle insert from shell script

Hi All I am trying to create a shell script to insert in to oracle table so far insert happens with out an issue, but i cant pass message variable to sqlplus script insert. i have highlighted the variable in red. Please help. thanks in advance. #!/bin/sh df -H | grep -vE... (3 Replies)
Discussion started by: LPK
3 Replies

2. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

3. Shell Programming and Scripting

UNIX shell script to format output report

i am new to unix shell scripting, could someone please help me. i was asked to develop a unix script and requirement of the script is as follows: 1. In source directory, if any new files are being dropped by external system then an email should be sent out with a message saying "files are... (3 Replies)
Discussion started by: crefi1545
3 Replies

4. UNIX for Dummies Questions & Answers

Insert new line in UNIX

Hai, How to insert a new line chracter "\n" in a line if it has more than 72 characters. My requirement is if the line has 72 characters i have to split it into two lines as follows. I/p line : this is a test line which is crossing seventy two characters so i have to split it -- this is of... (4 Replies)
Discussion started by: Sivajee
4 Replies

5. Linux

Is it possible to insert compile module after compiled "make" without installing

Hi gud day, I would like to ask if possible to load the driver i compiled module without installing it in the ubuntu-kernel-distro/updates* or simple not executing "make install". what i mean is i compile the compat wireless driver using make and i want to try to load on the system without... (1 Reply)
Discussion started by: jao_madn
1 Replies

6. Shell Programming and Scripting

Unix Shell Script to ping systems & make a log

Hi, I need to ping all the systems in my network and then create a log for the ones, from where I successfully get the ping-response (ICMP packet). Now, I've used the ping command successfully, but am unable to use 'grep' command to locate the IPs for which the ping was successful (so that I... (5 Replies)
Discussion started by: psychoTHEIST
5 Replies

7. Shell Programming and Scripting

shell script - insert oracle

Hi Frnds, in shell script I have one problem while inserting into oracle table . my script #! /usr/bin/sh while read record do echo $record X=`sqlplus -s STN/errrmddb20@MAHFDR <<eof insert into STN.STN_ERROR_TABLE values($record); eof`... (12 Replies)
Discussion started by: Gopal_Engg
12 Replies

8. Shell Programming and Scripting

Insert C code in shell script

Hi, Anybody know on how to insert C code in shell script. I am writing BLOB data to a database table in C but I don't know on how to insert the C code in shell script. Thanks in advance. (1 Reply)
Discussion started by: badbunny9316
1 Replies

9. Shell Programming and Scripting

Shell append or insert

Is there a way to append or insert a word into a text file? for example: if a file contains the lines...... profilename="test_profile" ear="${WpsInstallLocation}/installableApps/" conntype="SOAP" What I would like to have is the word test.ear inserted as below..... ... (4 Replies)
Discussion started by: norman_d_builde
4 Replies

10. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies
Login or Register to Ask a Question