Sponsored Content
Top Forums Shell Programming and Scripting Redirect the output to a .xls file Post 302389449 by pludi on Monday 25th of January 2010 02:37:42 AM
Old 01-25-2010
The Excel xls format is a binary file format. You'll have a very, very, very hard time writing it using only shell scripting. Better to use a scripting language like Perl for it, as you can use DBI, DBD::Sybase, and Spreadsheet::WriteExcel for a self-contained, platform-independent converter.

A different way would be to create a CSV as suggested, or to use ODBC to access the DB directly.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

redirect output to file?

Hi: I am currently working on a program which requires direct its ouput to a file here is an example ./proram arg_1 arg_2 when program ends all output will be arg_2 file Is that possible I am not a bad programmer, However I am stuck there. Can anyone give a hint? Thanks SW (1 Reply)
Discussion started by: slackware
1 Replies

2. UNIX for Dummies Questions & Answers

Redirect output to a file

Ahhhrrrggg I'm having a brain fart... I want to take the output of a command and redirect it to a file... This works.... $ man cp | cat >> copy_help but this doesn't keytool -help |cat >> keytool_help It just produces... these lines... more keytool_help ] ... ... (11 Replies)
Discussion started by: jimmyc
11 Replies

3. Shell Programming and Scripting

How to extract output from a script to .xls file

Hi, I am running a script, the output of which is needed to be filled in .xls file. I am doing this manually now, i mean I am writing the output of the script to Excel file manually. How to redirect the output of the script to .xls file? Please help me out!!! Thanks much, Scriptlearner. (6 Replies)
Discussion started by: scriptlearner
6 Replies

4. UNIX for Dummies Questions & Answers

redirect output to a file name

Hi all!! is possible to assign the output of some command to filename, i.e. grep_output.txt Otherwise, I want to open a new file which name is inside another, how can I do it? Thanks a lot! (7 Replies)
Discussion started by: csecnarf
7 Replies

5. Shell Programming and Scripting

converting xls file to txt file and xls to csv

I need to convert an excel file into a text file and an excel file into a CSV file.. any code to do that is appreciated thanks (6 Replies)
Discussion started by: bandar007
6 Replies

6. Shell Programming and Scripting

how to extract the data from database (oracle) and send the output as an .xls file?

Hi, How to extract the data from Oracle database and sent the output data to mails using mailx command with .xls attachement? Here i know how to connect the database using unix shell script and how to use the mailx command in UNIX script But i don't know how to use the .xls format file (i... (1 Reply)
Discussion started by: psiva_arul
1 Replies

7. Shell Programming and Scripting

How to redirect output of ls to a file?

Hi All, I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it. my ls -ltr output will be as below. -rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl -rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl I want my new file... (6 Replies)
Discussion started by: girish.raos
6 Replies

8. UNIX for Advanced & Expert Users

Redirect Topas output to a file

Hi, I want to know how to redirect the output of topas -P to a file in a readable format. I tried doing it by using topas -P > topas.txt but the output is not properly aligned and when I opened it using vi it ahd some characters. Please help me out in this. Thanks (1 Reply)
Discussion started by: Preetha
1 Replies

9. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

10. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies
DB2_PREPARE(3)								 1							    DB2_PREPARE(3)

db2_prepare - Prepares an SQL statement to be executed

SYNOPSIS
resource db2_prepare (resource $connection, string $statement, [array $options]) DESCRIPTION
db2_prepare(3) creates a prepared SQL statement which can include 0 or more parameter markers ( ? characters) representing parameters for input, output, or input/output. You can pass parameters to the prepared statement using db2_bind_param(3), or for input values only, as an array passed to db2_execute(3). There are three main advantages to using prepared statements in your application: o Performance: when you prepare a statement, the database server creates an optimized access plan for retrieving data with that statement. Subsequently issuing the prepared statement with db2_execute(3) enables the statements to reuse that access plan and avoids the overhead of dynamically creating a new access plan for every statement you issue. o Security: when you prepare a statement, you can include parameter markers for input values. When you execute a prepared statement with input values for placeholders, the database server checks each input value to ensure that the type matches the column defini- tion or parameter definition. o Advanced functionality: Parameter markers not only enable you to pass input values to prepared SQL statements, they also enable you to retrieve OUT and INOUT parameters from stored procedures using db2_bind_param(3). PARAMETERS
o $connection - A valid database connection resource variable as returned from db2_connect(3) or db2_pconnect(3). o $statement - An SQL statement, optionally containing one or more parameter markers.. o $options - An associative array containing statement options. You can use this parameter to request a scrollable cursor on database servers that support this functionality. For a description of valid statement options, see db2_set_option(3). RETURN VALUES
Returns a statement resource if the SQL statement was successfully parsed and prepared by the database server. Returns FALSE if the data- base server returned an error. You can determine which error was returned by calling db2_stmt_error(3) or db2_stmt_errormsg(3). EXAMPLES
Example #1 Preparing and executing an SQL statement with parameter markers The following example prepares an INSERT statement that accepts four parameter markers, then iterates over an array of arrays con- taining the input values to be passed to db2_execute(3). <?php $animals = array( array(0, 'cat', 'Pook', 3.2), array(1, 'dog', 'Peaches', 12.3), array(2, 'horse', 'Smarty', 350.0), ); $insert = 'INSERT INTO animals (id, breed, name, weight) VALUES (?, ?, ?, ?)'; $stmt = db2_prepare($conn, $insert); if ($stmt) { foreach ($animals as $animal) { $result = db2_execute($stmt, $animal); } } ?> SEE ALSO
db2_bind_param(3), db2_execute(3), db2_stmt_error(3), db2_stmt_errormsg(3). PHP Documentation Group DB2_PREPARE(3)
All times are GMT -4. The time now is 12:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy