Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using this unix script which it is fetching records in the form of csv. I have a SQL query used for this purpose. It contains below information

SET PAGESIZE 5000
SET COLSEP ","
SET LINESIZE 2000
SET FEEDBACK OFF
SET NEWPAGE NONE
SET UNDERLINE OFF

Is it due to PAGESIZE it is consuming more space?

The script returns 4MB of CSV(OBTM.csv) file whereas if I'm converting the same to (OBTM.xlsx) it is 48KB.

Kindly clarify my query

share|improve this question
    
What 'unix' script? Is this bash, ksh, zsh what? Could you give us an example of the .csv and .xlsx files generated? How are you converting? Are you on Unix,Linux, which one? –  terdon Sep 11 '13 at 12:34
    
@terdon I'm using Sun solaris Unix server which is ksh shell. I can't attach generated files. usppodivximf00(usoponshximf00):/vol01/sites/provisioning/IG> uname SunOS usppodivximf00(usoponshximf00):/vol01/sites/provisioning/IG> usppodivximf00(usoponshximf00):/vol01/sites/provisioning/IG> echo $0 -ksh usppodivximf00(usoponshximf00):/vol01/sites/provisioning/IG> –  user3475 Sep 11 '13 at 13:02
    
Please postthe details on how you are converting to csv and to xlsx and, if possible, a sample of the two files, yes. Either edit your question to post a few lines of each file or use a service like pastebin.com. –  terdon Sep 11 '13 at 13:07
    
How much data do you think there should be? Is it possible there really is 4MB of data and the xlsx file just contains a link to the data instead of holding the actual results? Also, I believe xlsx files compress the data; you might try gzipping your csv and see if it shrinks down to a similar size. –  drewbenn Sep 11 '13 at 14:34
    
Thanks for the script, however, that does not show the part where the csv and xlsx files are generated. If I understand correctly, that is being done by /vol01/sites/provisioning/IG/46762.sql or perhaps count.sh. Also, you might want to delete the email addresses from your script in pastebin to avoid SPAM. –  terdon Sep 11 '13 at 14:45

1 Answer 1

Most likely, each field in each record is space-padded to the field width. We'd need to see the query but instead of select * from table, you may need

select rtrim(field1) || ',' || rtrim(field2) || ',' || rtrim(field3) -- ...

Alternately, run the csv file through a sed script to trim excessive whitespace:

sed -i 's/[[:blank:]]\+,/,/g' OBTM.csv
share|improve this answer
    
@ terdon thanks for providing the new information about pastebin. I 'm sharing the pastebin link here. pastebin.com/3sN3sDPR @glenn I will try removing space. Kindly have a view on the script –  user3475 Sep 11 '13 at 13:40
    
@terdon/glenn ... I'm providing SQL query in this link...Kindly review and let me know if u need any information pastebin.com/pQnm4cRA –  user3475 Sep 11 '13 at 15:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.