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 add CRLF support for CSV file generated in unix amitpansuria High Level Programming 3 04-07-2008 01:18 PM
How to format excel sheets in UNIX?? Vijay06 Shell Programming and Scripting 2 05-16-2007 09:01 AM
Spilt excel file in unix Soumya Dash Shell Programming and Scripting 1 09-25-2006 02:56 AM
How to FTP a file generated at UNIX Box to NT Box Ruchir UNIX for Advanced & Expert Users 2 08-11-2005 05:55 AM
linking unix generated text file to html page alexd Shell Programming and Scripting 1 11-13-2002 12:21 PM

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 12-11-2007
Vijay06 Vijay06 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 16
Issues in the Format in excel file generated from unix machine

Hi,

I have generated a report that contains many columns and since I need ir in excel format.. I just renamed te file to excel as follows:

cp vijay.txt vijay.xls

I have just attached this spreadsheet in the mail and I am getting it to my mail id. But, in the output excel, the columns that have text xharacters are displayed correctly. Example:

Office name Office number employee name emp number
----------- -------------- --------------- --------------
trichy 012345 vijay 82389
chennai 008393 arun 00123
madurai 037489 vaas 82738
salem 134567 allen 92389

here...
the excel shows the second column as

12345
8393
37489
134567

excluding the zeros .. also in the last column

00123 as 123.

I need these zeros to be included in the excel output..

Is there any way this can be obtained?
Please help me to resolve this issue.

Thanks,
Vijayakumar.
  #2 (permalink)  
Old 12-11-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
You could either tell excel that the column is text or just put " symbols round the number.
  #3 (permalink)  
Old 12-12-2007
robsonde robsonde is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 162
Quote:
Originally Posted by Smiling Dragon View Post
You could either tell excel that the column is text or just put " symbols round the number.
I think Dragon is on to the right answer.

if Excel finds stuff in quotes it should keep it as text.
  #4 (permalink)  
Old 12-12-2007
Vijay06 Vijay06 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 16
Still not resolved!!!!

It doesn't work..
I tried keeping all the values in quotes.

i.e.

chennai as "chennai"
008393 as "008393"

and so on.

But, still the excel file that gets generated to the desktop doesn't has those zeros.
  #5 (permalink)  
Old 12-12-2007
user_prady user_prady is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 163
Smile

Quote:
Originally Posted by Vijay06 View Post
It doesn't work..
I tried keeping all the values in quotes.

i.e.

chennai as "chennai"
008393 as "008393"

and so on.

But, still the excel file that gets generated to the desktop doesn't has those zeros.
Try with this page
Formatting Cells in Excel

Select all your cells ,then go to the Format menu and then click on the Number tab in the Format Cells dialog box. There is also a choice named Special and when you choose that, you can select formats like Social Security Number, Phone Number, etc.

My OS is Japanese here so I cant try out the excel option..My Office is little different from English Office.

Hope it help you out..

-- user_prady
  #6 (permalink)  
Old 12-12-2007
rikxik's Avatar
rikxik rikxik is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 250
Well, Ygor's solution works for me:

Quote:
$ cat vijay.csv
chennai,="008393",arun,="00123"
chennai,="0083910",vijay,="00178"
When I double click on this file in Windows, all leading zeros are preserved.

Maybe you can post the top fiew lines of your output file.
  #7 (permalink)  
Old 12-12-2007
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,408
Quote:
Originally Posted by Vijay06 View Post
It doesn't work..
I tried keeping all the values in quotes.

i.e.

chennai as "chennai"
008393 as "008393"

and so on.

But, still the excel file that gets generated to the desktop doesn't has those zeros.
Using double-quotes on their own doesn't work, you need the preceeding equals sign as well.
Closed Thread

Bookmarks

Tags
unix commands

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 12:54 PM.


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