The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to extract paragraphs from file in BASH script followed by prefix ! , !! and !!! nabmufti Shell Programming and Scripting 6 02-09-2008 08:32 PM
Script that extract some lines from a file lookin into another heartwork Shell Programming and Scripting 7 01-25-2008 06:57 AM
compare file size from a output file from a script moustik Shell Programming and Scripting 7 11-07-2007 10:17 AM
Extract text in 2 columns of output file. Danish Shakil Shell Programming and Scripting 2 10-19-2007 11:03 AM
Script to Extract the line from File with specified offset thinakarmani UNIX for Advanced & Expert Users 5 05-04-2006 06:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-06-2007
scriptlearner scriptlearner is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 6
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.
  #2 (permalink)  
Old 08-06-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
You can just format your output such that the values of the output are delimited to "," and are redirected to a CSV file.

So you can use to CSV file to view your output in the excel format
  #3 (permalink)  
Old 08-06-2007
firdousamir firdousamir is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 25
You mean you are copying outputs from the screen to an excel file?

You can format your outputs in CSV format (like lorcan suggested) and redirect the script out to a file say,

$ sh your_script.sh > your_output.csv

does that help?
  #4 (permalink)  
Old 08-07-2007
scriptlearner scriptlearner is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 6
Hi,

Thanks a lot. Yep,it works if I am extracting output from .sh file. Actually I have one shell script i.e myscripts.sh, in which it calls other .sql scripts which are in my home directory. Actually I wanted the output of .sql scripts to .csv file. I tried to get the output of .sql to .csv, but it is throwing error. Can I redirect the output from myscripts.sh to myouput.csv?Is that possible? Please help me.

Thanks much in advance,
Scriptlearner.
  #5 (permalink)  
Old 08-07-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
You cannot redirect the SQL queries to the files. Instead you can use the spool concept in ORACLE (hope Oracle is the database).

Spool your output such that the records are comma separated.

something like the below;

Code:
select sysdate||","|| sysdate from dual;
spool on;
/
spool off;
This will have the output from the sql command into the Spool file.
  #6 (permalink)  
Old 08-10-2007
scriptlearner scriptlearner is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 6
Thanks a lot for your help. I got that. Initially I got problem coz my.sql script had control characters in it. Now it is working fine.

Thanks a lot,
Scriptlearner.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0