Formatting Shell script output to Excel

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Formatting Shell script output to Excel
# 1  
Old 12-13-2012
Formatting Shell script output to Excel

I am facing a problem formatting the output of my shell script in excel.
We are directing the output of the script to an excel sheet and need long integer type data printed in Excel as it is (i.e. not in the default scientific notation).
Also, leading zeroes(if any) in the output are getting truncated in the excel file.

For example:

Output of the shell script: 012310004594882
Current output from Excel: 1.231E+13
Desired output in Excel sheet: 012310004594882

Could someone help me with this.
I am using ksh.
# 2  
Old 12-13-2012
This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 12-13-2012

Thanks itkamaraj,

But as I wanted to know if there was a way of doing the formatting using shell script itself rather than manually as described in the link you posted.

The output of my script is directly fed to an excel sheet which gets created each time it is run. We need to ensure that before our data is fed, the excel sheet is already in text mode.We cannot afford to review the data format in excel,as the excel sheet is directly supposed to be attached in an email and sent off.
# 4  
Old 12-13-2012
You could try to enclose that field in double quotes, like "012310004594882". If that doesn't help, try double quotes PLUS leading apostrophe: "'012310004594882"
# 5  
Old 12-13-2012
It is the default beahaviour of excel. If it exceeds certain digits of number, it will turn the number to scientific notation. You can avoid by choosing the different format.

i guess, you are creating the .csv file and sending in email. One of the way to keep the number, you need to use single quote.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script, For loop output to excel as columns

Hi, I have a shell script which analyses the log folder for a specific string and throws me the output. I have used for loop since it does this in multiple servers. Now I want to save the output in a excel in the below format. Can someone please help? The output which I get Server1 : count... (14 Replies)
Discussion started by: srilaxman
14 Replies

2. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

3. Shell Programming and Scripting

SQL Query in Shell Script output formatting

Hi All, #!/bin/ksh call_sql () { sql=$1 sqlplus -s $sqlparam_sieb <<EOF SET ECHO OFF; SET NEWPAGE NONE; SET SQLBL OFF; SET VERIFY OFF; SET LINESIZE 2000; SET... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies

4. Shell Programming and Scripting

Writing excel file using perl : Excel file formatting changed

I am trying to create a program where user can input data in certain excel cells using user interface on internet....the programming is on perl and server is unix But when i parse data into excel the formatting of sheets is turned to default and all macro coding removed. What to do...Please... (7 Replies)
Discussion started by: mud_born
7 Replies

5. Shell Programming and Scripting

Formatting output of script

I'm looking for a way to neaten up the out put of an ldapquery. I might get one, none, or several returns for each query; and each query consists of multiple lines. And while each return will contain the same types of info, it might be in a different order, like: uniq: 1 ip: (3 Replies)
Discussion started by: jnojr
3 Replies

6. Shell Programming and Scripting

Problem in formatting output of SQL query in excel sheet in shell script

Hi Guys.. Need your help to format the output of my shell script. I am using spool command to take out put in csv file. below is my code. (for example) col USERNAME for a15 col EMAIL for a30 col FULL_NAME for a20 col LAST_LOGIN for a40 col DATE_CREATED for a40 SPOOL 120.csv... (3 Replies)
Discussion started by: Agupte
3 Replies

7. Shell Programming and Scripting

sql select command output formatting in shell script

Hi, I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification in short select var,data from usage; o/p=... (1 Reply)
Discussion started by: rkrish
1 Replies

8. Shell Programming and Scripting

Formatting the query output using shell script

Hi All, I'm finding it difficult to format the query output that was returned in a shell script. Actually i have one shell script which does some DB stuff and depending on the result it will do some more tasks. My question here is to format the query output returned by mysql. Intitally my... (5 Replies)
Discussion started by: RSC1985
5 Replies

9. Shell Programming and Scripting

Formatting the output of a script

Dear readers, I have a script that counts the number of files in particular directories in my home location and displays the output. Now I have 13 directories in my home location. I am getting the output as : Avishek_dir 13 Kunal_dir 17 Shantanu_dir 18 Arup_dir 12 Pranabesh_dir 19 . .... (7 Replies)
Discussion started by: avishek007
7 Replies

10. Shell Programming and Scripting

[SHELL] Output formatting

I am looking for a way to format the output of this string into comma separated values (.csv) so I can import into excel. Also I want to remove any white space generated by the commands, particularly the dmidecode as the output has lots of space in front of Serial Number. #!/bin/bash for... (8 Replies)
Discussion started by: Adrnalnrsh
8 Replies
Login or Register to Ask a Question

Featured Tech Videos