Operating System - HP-UX
1827730 Members
2953 Online
109968 Solutions
New Discussion

Re: Convert unix text file to windows txt file, open in Excel

 

Convert unix text file to windows txt file, open in Excel

FTP a text file from HP-UX to windows. Open in Microsoft Excel. Sees special characters (squares) how to I remove the special characters?
no personal quote
6 REPLIES 6
Patrick Wallek
Honored Contributor

Re: Convert unix text file to windows txt file, open in Excel

Before you FTP it to your Windows machine run 'ux2dos' against the file.

# ux2dos filename > new_filename

# man ux2dos

for more information.
Denver Osborn
Honored Contributor

Re: Convert unix text file to windows txt file, open in Excel

also don't forget to send in ascii mode and not binary....

ftp> asci
Jose Mosquera
Honored Contributor

Re: Convert unix text file to windows txt file, open in Excel

Hi,

TIP: If you separate fields with tab characters "echo \t" into unix file and set the name of file as filename.xls when you put it on windows environment and double click it, the file will open automatically and fields will be separate in columns.

Look this example:

In your unix box do:
echo "field1\tfield2\field3\t" > example.xls
Then ftp it in ASCII mode to an WIN environment and finally double click it!


Rgds.
Chris Vail
Honored Contributor

Re: Convert unix text file to windows txt file, open in Excel

Even better than characters (\t), use commas as the column separator, and save the file with a .csv extension. Then, instead of FTP'ing the file, use email, and attach it as a MIME compliant document. The command "uuencode FILE FILE|mailx -s "Subject" you@yourdomain.com" will accomplish this. Your document will show up very quickly in your email folder. Double click on the attached document, and Excel will open up automajically with the file loaded. Then mess with it in Excel: adjust column widths, make it pretty, and then save it as a .xls extention as every Excel spreadsheet. T'is a lot easier all around, and you can script the whole process.

Chris
Steven E. Protter
Exalted Contributor

Re: Convert unix text file to windows txt file, open in Excel

Try emailing the text file if possible. This script is ACTUALLY used to send an ascii file that the user needs to use as a spreadsheet.

Just an alternative. HP came up with it, I modified it. It's production.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
monasingh_1
Trusted Contributor

Re: Convert unix text file to windows txt file, open in Excel

If your source is simple text, simply cat 'filename'|mailx should work, cut and paste from mail attchment to excel or save the attachment and then open....