exporting number into .csv file in text form (no other extra charc) from shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting exporting number into .csv file in text form (no other extra charc) from shell script
# 1  
Old 03-13-2008
Java exporting number into .csv file in text form (no other extra charc) from shell script

I have written a k shell program which is executing a sql and exporting data in numeric form like 0412323444 into .csv file. the problem i am facing is that , the data is coming in excel formatted in scientific form like 4.1+E08,while my requirement is to store data as such 0412323444 in excel ( no other extra character like '(single quote) or double quote.

please help me in this regard
# 2  
Old 03-13-2008
Hammer & Screwdriver A trick I discovered

Something I discovered way back when...
export data in the following pattern:

="Need to know",="0123456",="0101010"

The combination of the = and the " " cause Excel to store data specifically as text.
# 3  
Old 03-13-2008
Joeyg,

it is true that appending some character convert number into text and can be stored in the .csv format .but what is required i have to export number as such in the excel without any extra character .

if the number is 041008.it should be exported as 041008 in the excel.
is there any way we can do this through shell script.
# 4  
Old 03-13-2008
Question

If your k-shell script is writing the data (confused by your follow-up note) in csv format so that it can later (or in next step) be read by Excel, then write it as I described.

="Need to know",="0123456",="0101010"
="howdy there",="0028410",="0001313"

and so on.

What does the current csv file look like? Please supply a small piece, or a few lines.
# 5  
Old 03-13-2008
Actually I am running a sql commnad which is selecting numeric data from a database table ,i am exporting this data in .csv file.
The database table is containing data like
04567891245645
01234583445674
08967565678565

What .csv file is generating is
4.5+E10
1.2+E8
8.9+E8

the .csv file is automatically taking in scienific format.

while my requirement is to store data in .csv file in form of
04567891245645
01234583445674
08967565678565
(no extra quote or character)
# 6  
Old 03-13-2008
Question Want to write csv in specific format

You want the csv file to consist of:

="04567891245645"
="01234583445674"
="08967565678565"

Then, when opened by Excel, it will be fine.


The csv file is not storing - at least I don't think so
Quote:
What .csv file is generating is
4.5+E10
1.2+E8
8.9+E8
Thus, my request to see the contents of the csv file and not what Excel is reading.
A couple of lines would suffice.

(I had to write an intermediate script to do what I am proposing for a similar matter.)

Last edited by joeyg; 03-13-2008 at 05:28 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to Insert three extra columns in csv file

Hello Experts, I got a requirement i have a input file which am getting from different source,Now i want to add extra 3 columns to this file like BASE,ACTUAL and DATE. Input File Looks like QUAL CHGE TYP LAW COM1 COM2 A 1 X SED HO ASE B 3 Z CDE SE ... (5 Replies)
Discussion started by: ahmed.vaghar
5 Replies

2. Shell Programming and Scripting

Shell scripting:from text file to CSV

Hello friends, I have a file as follows: "empty line" content1 content2 content3 content1 content2 content3 content1 content2 content3 It starts with an empty line, how can i get a csv like this: (12 Replies)
Discussion started by: kraterions
12 Replies

3. UNIX for Dummies Questions & Answers

To Add extra commas to a CSV file.

Hi All, I got this requirement to process a complex CSV file. Eg File. Line 1: Name:,XYz Line 2: Age:,15 Line 3: Grade:,7 Line 4: Line 5: English, Maths, Science,Spanish Line 6:10,11,13,14 As you can see the maximum column is 4 . The file i need to make is Line 1: Name:,XYz,,... (12 Replies)
Discussion started by: chillblue
12 Replies

4. Shell Programming and Scripting

Adding Extra Commas to a CSV file

Trying in this forum. Not sure if it is permitted.... but in need of help. Please find the requirements in the below link. https://www.unix.com/unix-dummies-questions-answers/191503-add-extra-commas-csv-file-2.html#post302665179 Thanks in Advance. (1 Reply)
Discussion started by: chillblue
1 Replies

5. Shell Programming and Scripting

shell script to remove extra commas from CSV outp file

Name,,,,,,,,,,,,,,,,,,,,Domain,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Contact,Phone,Email,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Location -----------------------,------------------------------------------------,-------,-----,---------------------------------,------------------------------------ ----... (1 Reply)
Discussion started by: sreenath1037
1 Replies

6. Shell Programming and Scripting

Remove duplicate commas after exporting excel file to csv

Hello everyone I'm new here and this is my first post so first of all I want to say that this is a great forum and I have managed to found most of my answers in these forums : ) So with that I ask you my first question: I have an excel file which I saved as a csv. However the excel file... (3 Replies)
Discussion started by: Spunkerspawn
3 Replies

7. Shell Programming and Scripting

Exporting data as a CSV file from Unix shell script

Friends...This is the first time i am trying the report generation using shell script... any suggestions are welcome. Is there a way to set the font size & color when i am exporting the data from unix shell script as a CSV file ? The following sample data is saved as a .csv file in the... (2 Replies)
Discussion started by: appu2176
2 Replies

8. Shell Programming and Scripting

Exporting .csv file into mysql server 2005 using script.

Hi, I have a .csv file created by a script with data in a tabular format. I need to insert all the value into mysql database which is running in a different machine. what is the command to export the .csv file into database using shell script. Thanks in advance. (3 Replies)
Discussion started by: ahamed
3 Replies

9. Shell Programming and Scripting

csh script for deleting extra spaces in text file

I am new to scripting and I needed to know if there would be an easy way to delete extra spaces in a text file. I have a file with three rows with 22 numbers each, but there is extra spaces between the numbers when it gets output by this program AFNI that I am using. What script would help delete... (2 Replies)
Discussion started by: hertingm
2 Replies

10. Shell Programming and Scripting

Exporting text file data to csv

Could any one help me in basic shell script to export text file data to csv. I need to export only particular data from text file to csv column. I am a newbie to UNIX could anyone help me with sample script code (3 Replies)
Discussion started by: l_jayakumar
3 Replies
Login or Register to Ask a Question