Sponsored Content
Full Discussion: processing db2 output
Top Forums Shell Programming and Scripting processing db2 output Post 302412543 by durden_tyler on Tuesday 13th of April 2010 12:09:38 AM
Old 04-13-2010
Code:
$ 
$ 
$ perl -F= -lane 'chomp; $F[1]=~s/^\s*|\s*$//g;
>                 if (!/^Database/) {
>                   if (! $disp) {
>                     $F[0]=~s/^\s*|\s*$//g;
>                     $hdr .= ",$F[0]";
>                   }
>                   $data .= ",$F[1]";
>                 }
>                 elsif (/^Database/) {
>                   if ($hdr) {
>                     print substr($hdr,1);
>                     $hdr=""; $disp=1;
>                   }
>                   if ($data) {
>                     print substr($data,1);
>                     $data="";
>                   }
>                 }
>                 END {print substr($data,1)}
>                ' db2_output
Database alias,Database name,Node name,Database release level,Comment,Directory entry type,Catalog database partition number,Alternate server hostname,Alternate server port number
DB1,DB1,ND1,a.00,,Remote,-1,,
DB2,DB2,ND2,a.00,,Remote,SERVER,-1,,
DB3,DB3,ND3,a.00,,Remote,-1,,
DB4,DB4,/home/db4,a.00,,Indirect,0,,
DB5,DB5,/home/db5,a.00,,Indirect,0,,
$ 
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

flags to suppress column output, # of rows selected in db2 sql in UNIX

Hello, I am new to db2 SQL in unix so bear with me while I try to explain the situation. I have a text file that has the contents of the where condition that I am using for a db2 SQL in UNIX ksh. Here is the snippet. if ; then echo "Begin processing VALUEs" ... (1 Reply)
Discussion started by: jerardfjay
1 Replies

2. Shell Programming and Scripting

Run SQL queries in DB2 and output to file

Hi, I new to Unix and scripting. Following is my requirement. Can someone tell me whether its possible or not. Also please let me know how to proceed further if this is possible. List of queries are stored in a file. For example, I have to run a query like this: Select * from &XYZ where... (0 Replies)
Discussion started by: simhasuri
0 Replies

3. Shell Programming and Scripting

running db2 sql and exporting output from ksh scipt

Hi there, I am trying to write a shell script as root on AIX 5.3 where I change user to db2inst1, connect to our db2 database, run a sql select query and export the result of the query to a file. The code I have so far is as follows:- #!/usr/bin/ksh su - db2inst1 -c "db2 connect to... (0 Replies)
Discussion started by: candlino
0 Replies

4. UNIX for Dummies Questions & Answers

Exception while loading DB2 driver Class.forName("com.ibm.db2.jcc.DB2Driver")

Hi... I m working on UNIX z/OS. Actually i have to pass the parameters from the JCL to java-db2 program thru PARM. I am able to pass the arguments but the problem occured is, it is throwing an exception while loading the db2 driver as 'Javaclassnotfound:com.ibm.db2.jcc.DB2Driver'... (0 Replies)
Discussion started by: Sujatha Gowda
0 Replies

5. IP Networking

processing tcpflow output

I'm using tcpflow to analyze traffic traces. When I launch tcpflow with -r option it creates some files, one for each flow. The problem is that some of these files are not readable. I tryed to process them with awk, but also using it i cannot visualize them correctly. Can anyone suggest me a... (5 Replies)
Discussion started by: littleboyblu
5 Replies

6. Shell Programming and Scripting

Need Fix in Exporting a db2 query output

When I use export for sql query in a Script : Select '1',ModHist',count(*) from cc.mdhist; it was exporting the record to a file as: "1" "ModHist" 778201 Here 1 & ModHist are coming in Doublequotes. If I run the above query directly in Unix prompt it was displaying the output as... (1 Reply)
Discussion started by: karumudi7
1 Replies

7. Shell Programming and Scripting

processing the output of AWK

Hi my input file is <so > < Time > <Pid> <some ro><Job Name> 111004 04554447 26817 JOB03275 MBPDVLOI 111004 04554473 26817 JOB03275 MBPDVLOI 111004 04554778 26807 JOB03276 MBPDVAWD 111004 04554779 26807 JOB03276 MBPDVAWD 111004 04554780 26817 ... (4 Replies)
Discussion started by: rakeshkumar
4 Replies

8. Shell Programming and Scripting

Printing the output of a db2 query on to an unix file

I want to print the output of a db2 query, on to an unix file in a manner that the columns are separated by 'commas'. Please help me out..thanx in advance (1 Reply)
Discussion started by: prasan_ven
1 Replies

9. UNIX for Dummies Questions & Answers

Take output of processing in text file

Hi ALL, I am presently using perl script mukesh.pl I just want to catch its output into another text file . So I am using > File.txt . I am getting output but i want the whole processing of the script into that file please let me know . Thanks in advance Cheers Mukesh (1 Reply)
Discussion started by: mumakhij
1 Replies

10. Shell Programming and Scripting

Processing diff output

How to get diff to not print the chevrons and the dashes? In this case the differences are all single line differences. Also the first few lines don't matter. How to get the output to always exclude the first few lines? Thanks! (1 Reply)
Discussion started by: stevensw
1 Replies
PHISTO(1)						      General Commands Manual							 PHISTO(1)

NAME
phisto - compute a luminance histogram from one or more RADIANCE pictures SYNOPSIS
phisto picture .. DESCRIPTION
Phisto is a script that calls pfilt(1), rcalc(1) and histo(1) to compute a histogram of log luminance values for foveal samples in the given picture files. A foveal sample covers approximately 1 degree, though this script does not use this exact area. The minimum and max- imum values are determined, and 100 histogram bins are uniformly divided between these extrema. Foveal samples less than 1e-7 cande- las/sq.meter are silently ignored. If no picture is named on the command line, the standard input is read. The primary function of this script is to precompute histograms for the pcond(1) program, which may then be used to compute multiple, iden- tical exposures. This is especially useful for animations and image comparisons. EXAMPLE
To compute two identical tone mappings for image1.hdr and image2.hdr: phisto image1.hdr image2.hdr > both.histo pcond -I -h image1.hdr < both.histo > image1m.hdr pcond -I -h image2.hdr < both.histo > image2m.hdr AUTHOR
Greg Ward Larson SEE ALSO
histo(1), pcond(1), pfilt(1), pvalue(1), rcalc(1), total(1) RADIANCE
3/12/98 PHISTO(1)
All times are GMT -4. The time now is 11:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy