Redirecting the reports into the database


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Redirecting the reports into the database
# 1  
Old 04-26-2007
Redirecting the reports into the database

STATUS REPORT FOR JOB: Ftp
Generated: 2007-04-26 19:38:34
Job start time=2007-04-14 13:50:21
Job end time=2007-04-14 13:50:29
Job elapsed time=00:00:08
Job status=1 (Finished OK)

The above report is application generated report.

can any provide me the script to insert the Bolded records into database while generating itself.

Pls.iam new to Shell script.

(or )


STATUS REPORT FOR JOB: Ftp
Generated: 2007-04-26 19:38:34
Job start time=2007-04-14 13:50:21
Job end time=2007-04-14 13:50:29
Job elapsed time=00:00:08
Job status=1 (Finished OK)

I would like to insert the BOLD items into the database.

Column names in the database are
1.JOB
2.Job start time
3.Job end time
4.Job elapsed time
5.Job status
# 2  
Old 04-26-2007
assume sample data as it is, this is a crude awk way:
Code:
awk 'BEGIN{ FS = "[=:]" }
     /REPORT/ { ftp = $2 }
     /Generated/ { generated = sprintf("%s:%s:%s", $2,$3,$4)  }
     /elapsed/ { elapsed = sprintf("%s:%s:%s", $2,$3,$4)  }
     /start time/ {start =  sprintf("%s:%s:%s", $2,$3,$4) }
     /end time/ {end = sprintf("%s:%s:%s", $2,$3,$4) }
     /status/ { sub(/\(Finish.*/,"",$2); status=$2}     
END { 
      printf "insert table_name values(\"%s\", \"%s\" , \"%s\",\"%s\",\"%s\")\n" , ftp,start,end,elapsed,status
    }' "file"

# 3  
Old 04-26-2007
Code works fine .

But i am not able to insert it into database.

can anyone provide me with connecting database and how it is inserting

through the printf statement.

please provide me all the things in a single script.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Concatenation of different reports dynamically

Hi, I have the following reports that get generated every 1 hour and this is my requirement: 1. 5 reports get generated every hour with the names "Report.Dddmmyy.Thhmiss.CTLR" "Report.Dddmmyy.Thhmiss.ACCD" "Report.Dddmmyy.Thhmiss.BCCD" "Report.Dddmmyy.Thhmiss.CCCD"... (1 Reply)
Discussion started by: Jesshelle David
1 Replies

2. Shell Programming and Scripting

RSYSLOG reports

I want to create reports using rsyslog in linux,Can someone help me out here ? Report Format must be "Hostname" "Username" "Hostname logged from" "Date" "Time" Regards, Ahmed. ---------- Post updated at 05:24 PM ---------- Previous update was at 05:24 PM ---------- Linux,Shell Script (10 Replies)
Discussion started by: ahmed.vaghar
10 Replies

3. Red Hat

intodns.com reports old IP

Hello, I have this problem: I have a domain which worked well until my ISP changed my ip. Since then my DNS is not working, and intodns.com reports still the old IP. The DNS remains the same. I made changes in named.conf, in ifcfg-Auto_eth0, I flushed the cache but it;s the same thing. What... (6 Replies)
Discussion started by: doe_ro
6 Replies

4. Shell Programming and Scripting

CRON Job to copy database and replace existing database

I have a reseller account with hostgator, which means i have WHM and Cpanel. I have set up a staging environment for one of my wordpress installations (client website), which is essentially sitting at staging.domain.com (live site is at domain.com). The staging website is a complete copy of the... (1 Reply)
Discussion started by: nzrobert
1 Replies

5. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

6. Solaris

redirect solaris database from linux database..

hi.. i have a need .. my php runs on my linux redhat box with mysql.. i want my php code to refer another mysql database which is in solaris 10 x86... can u tell me the procedure .. how it can be done through php .. sorry am new to php... is it possible to redirect from linux mysql to... (7 Replies)
Discussion started by: senkerth
7 Replies

7. AIX

login reports on AIX43

Hi, There's a report the previous AIX admin used to do and I couldn't find it on the AIX /etc/security. I think this customized. Last update report (sample): USER NAME IN REAL LIFE DATE LAST CHANGED PASSWORD ---- ----------------- ... (3 Replies)
Discussion started by: itik
3 Replies

8. HP-UX

Hp-ux 11.11 and Oracle reports

HI I am battling to find why oracle reports dont work from the Oracle applications and work from the Command line Finally, whern these reports error out in the Oracle apps, I see the error that the x server killed the process. Please let me know if any one has some chi-chi sheet on the os setup... (1 Reply)
Discussion started by: schilukuri
1 Replies
Login or Register to Ask a Question