02-07-2012
Here is my coding:
export ORACLE_SID=ABCD
result=`sqlplus -s /NOLOG << EOF
connect username/pass
SELECT count(*) from A;
`
The same way, am collectng all the 5 query's results in 5 different variables and finally printing on the screen using the print statement. Till this it works perfectly..
result_set=`printf "A: %d\n" $result
printf "B: %d\n" $result1
printf "C %d\n" $result2
printf "D: %d\n" $result3
printf "E: %d\n" $result4
`
Now am collectng altogether in result_set (which I think is unwanted) and then exporting this to csv file.
echo $result_set > results.csv
here it prints everythng in a single line...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have requirement where i have to export the data extracted from a flat file to a microsoft excel sheet. If the awk returns multiple records then all these records should go in into different rows of same column in excel.
Eg. say data returned by excel is A,B,C,D then these 4 records should go... (1 Reply)
Discussion started by: goutam_igate
1 Replies
2. Shell Programming and Scripting
The awk is giving below output:
SELECT
divrel.child_org_idn org_main_idn
NULL ( VARCHAR(200)) div_nam_2
NULL ( VARCHAR(200)) div_nam_3
NULL ( VARCHAR(200)) div_nam_4
NULL ( VARCHAR(200)) div_nam_5
NULL ( VARCHAR(200)) div_nam_6
NULL ( VARCHAR(200)) div_nam_7
... (2 Replies)
Discussion started by: goutam_igate
2 Replies
3. Shell Programming and Scripting
I have multiple condition in file as below.
MONITOR "ALERT_INFO"
DESCRIPTION "Triggered when informational Netware alert occured"
MAXTHRESHOLD 95
SEVERITY Normal
MONITOR "ALERT_MAJOR"
DESCRIPTION "Triggered when major Netware alert occured"
MAXTHRESHOLD
SEVERITY Major
I need to... (6 Replies)
Discussion started by: velocitnitin
6 Replies
4. Shell Programming and Scripting
Hi everyone,
I am new to unix and bash and in need of some help.
I am writing a script that will execute a SQL query. The script runs and the SQl query runs, but I cannot figure out how to save the results as a file that can be emailed to a user. Here is my scripts thus far:
#!/bin/sh
SID=$1... (2 Replies)
Discussion started by: alpinescott
2 Replies
5. Shell Programming and Scripting
i need to write script to copy the txt file to excel. (data can be 2000+), data may not be in order
ex:
my name: abc
age: 20
add: xyz
DOB: 17-mar-2010
add1: adf
add2: guioth
my name: cat
age: 35
DOB: 11-oct-2005
city: yeshjl
add: opq
DOB: 17-mar-2010
add1: atg
add2: gth
add3:ert
... (2 Replies)
Discussion started by: pjain
2 Replies
6. OS X (Apple)
Hello,
This is my first post so not sure what response I will get
I do have a very small knowledge of UNIX used last over 10 years ago
I have recently move over to an Apple IMAC
I need to copy all my jpg files into excel
Could someone please let me know if this is possible and... (2 Replies)
Discussion started by: Nacnud
2 Replies
7. Shell Programming and Scripting
Hello All,
I need to execute around 15 queries after which all data should come in Excel format.
Executing 15 queries is not a problem.
Problem is how to present/put data in excel.
kindly suggest me how to start, what to study or what should i do.
thanks, (1 Reply)
Discussion started by: shubham8787
1 Replies
8. UNIX for Advanced & Expert Users
Hi I am working on a script in which I am firing a query on database through Unix and getting the result set. I want to export that in an excel file. I am able to do so nut the result are exported horizontally one below the other. Can anyone plss help me out in exporting the Result in Tabular... (4 Replies)
Discussion started by: Saritau3
4 Replies
9. Shell Programming and Scripting
Export data from database in Excel sheet with the help of Shell script and automated the report every day in the mornig. (1 Reply)
Discussion started by: neeraj617
1 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table.
Can you please suggest why? or any better idea?
export FILE="/abc/autom/file/geo_JOB.csv"
Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Discussion started by: Hope
16 Replies