PDA

View Full Version : Export excel sheet to .txt, reformat to .dat. But format changes in Linux



viaaa
02-24-2016, 03:35 PM
Hi,

I exported an excel sheet into txt file, then changed the file extension from txt to dat. I opened the dat file in windows and everything looked good. Below how it looks like.
:Product Code: 0xfaa
:Magic Number: 0xfaa1
:Version Num : 0xd
#
Date : 7/7/2014
DEFAULT 50
#
HIGH (75) 0 0 0.4 0.4 0.8 0.6 0.4 1.2 1.4 1.4 1 1 0.8 1.6 0.6 0.8 1 1.8 1.1 3.5 2.2 0.8 0.5 0.6 1 0.6 1.6 1 0.6 0.8 1 2.4 2.7 1.8 1.1 1.3 2.2
MEDIUM (50) 0 0 0.3 0.3 0.7 0.5 0.3 1 1.2 1.2 0.8 0.8 0.7 1.3 0.5 0.7 0.8 1.7 1.1 3.4 2.1 0.8 0.5 0.6 0.9 0.6 1.5 0.9 0.6 0.8 0.9 2.3 2.6 1.7 1.1 1.2 2.1
LOW (25) 0 0 0.3 0.3 0.6 0.5 0.3 0.9 1.1 1.1 0.8 0.8 0.6 1.2 0.5 0.6 0.8 1.5 1 3.1 1.9 0.7 0.4 0.6 0.8 0.6 1.4 0.8 0.6 0.7 0.8 2.1 2.4 1.5 1 1.1 1.9
END_HISTORICAL_POPUPS


I need to read the dat file into a simulation tool in a linux machine. The weird thing is, if I open the same dat file in Linux, the file format changes and can't be read successfully into the simulation tool. Below is how it looks like if opened in linux.

:Product Code:
0xfaa
:Magic Number:
0xfaa1
:Version Num :
0xd
#
Date :
7/7/2014
DEFAULT
50
#
HIGH (75) 0 0 0.4 0.4 0.8 0.6 0.4 1.2 1.4 1.4 1 1 0.8 1.6 0.6 0.8 1 1.8 1.1 3.5 2.2 0.8 0.5 0.6 1 0.6 1.6 1 0.6 0.8 1 2.4 2.7 1.8 1.1 1.3 2.2
MEDIUM (50) 0 0 0.3 0.3 0.7 0.5 0.3 1 1.2 1.2 0.8 0.8 0.7 1.3 0.5 0.7 0.8 1.7 1.1 3.4 2.1 0.8 0.5 0.6 0.9 0.6 1.5 0.9 0.6 0.8 0.9 2.3 2.6 1.7 1.1 1.2 2.1
LOW (25) 0 0 0.3 0.3 0.6 0.5 0.3 0.9 1.1 1.1 0.8 0.8 0.6 1.2 0.5 0.6 0.8 1.5 1 3.1 1.9 0.7 0.4 0.6 0.8 0.6 1.4 0.8 0.6 0.7 0.8 2.1 2.4 1.5 1 1.1 1.9
END_HISTORICAL_POPUPS

I don't know why this happens and how I can fix the problem. Any suggestions are appreciated!

SamT
02-24-2016, 05:46 PM
I lost my magnifying glass. Can you point out the differences?

BTW, What Windows application did you open the *.dat file with?

viaaa
02-24-2016, 06:49 PM
Hi,

Thanks for your reply. The difference is that the linux breaks some of the lines into two lines. For example, it breaks
:Product Code: 0xfaa

into the following two lines:
:Product Code:
0xfaa

I open the .dat file with notepad and wordpad in Windows.



I lost my magnifying glass. Can you point out the differences?

BTW, What Windows application did you open the *.dat file with?

snb
02-25-2016, 01:21 AM
Is there a Tab between : and 0xfaa ?

viaaa
02-25-2016, 02:52 PM
I open the file using wordpad, and it is a space, not a tab.


Is there a Tab between : and 0xfaa ?

snb
02-25-2016, 03:53 PM
is it a problem if you remove the space after : ?

viaaa
02-26-2016, 08:07 AM
There problem is that it is a long file and Ican't manually find all the spaces and remove them. I can't do remove all,since some spaces are interpreted correctly and some are not. But it is ok. Ifigured instead of figuring out the linux/windows difference, I can avoid theproblem in some other silly ways, e.g. copy-paste the part I want to theoriginal linux file. Thank you for your help and patience.


is it a problem if you remove the space after : ?