Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Different format of .dat files in different software

Tags:
  1. May 16, 2016 #1

    kelvin490

    User Avatar
    Gold Member

    I have generated some .dat files using Fortran on a cluster. I need to use WinSCP(https://winscp.net/eng/download.php) to access files in the cluster so sometimes I just use the WinSCP to open the .dat files generated. The data can be shown regularly like this one: https://www.dropbox.com/home/Pictures?preview=notepad2.jpg
    notepad2.jpg

    However, if I download it to my desktop and open it with notepad it becomes like this: https://www.dropbox.com/home/Pictures?preview=notepad1.jpg

    notepad1.jpg
    It bothers me because usually I read the file in PC and I need to share it to some other people and I don't expect they open it in WinSCP. How can I change the format so it looks better? Thank you.
     
    Last edited: May 16, 2016
  2. jcsd
  3. May 16, 2016 #2

    phinds

    User Avatar
    Gold Member
    2016 Award

    Dropbox requires a sign-in for your links. You should use some other method.
     
  4. May 16, 2016 #3

    Mark44

    Staff: Mentor

    I agree completely. Can't you just attach the files, instead of posting images of them?

    BTW, are the .dat files you (OP) create text files or are they binary files?
     
  5. May 16, 2016 #4

    kelvin490

    User Avatar
    Gold Member

    Sorry for the trouble. Actually I tried to attach pictures directly but it still ask me to put the picture's URL. I copied the link to it but it seems doesn't work.
    For the .dat file, I only know it's .DAT type by checking the properties of the file. In Fortran I just use the "open" function, for example: open(10, file = 'Overall.dat', form = 'formatted',status = 'unknown',position="append") to create and then write the file. Curiously, if I run the program in my PC, the file generated is good and just looks like the first picture above. The problem just occurs when I run it in the cluster to creates the .dat file then download it to my PC.
     
  6. May 16, 2016 #5

    phinds

    User Avatar
    Gold Member
    2016 Award

    Well, don't fool around with links (URLs), just post the images here directly.
     
  7. May 16, 2016 #6

    Borg

    User Avatar
    Science Advisor
    Gold Member

    Use the upload button on the bottom right to post pics from your computer.
     
  8. May 16, 2016 #7

    kelvin490

    User Avatar
    Gold Member

    I can attach it now. Thanks a lot.
     
  9. May 16, 2016 #8

    jim mcnamara

    User Avatar

    Staff: Mentor

    I think you are running afoul of the carriage control (how the computer says "give me the next line").
    Fortran uses a channel control character like a '0' as the very first character of a "line". gfortran still implements this.

    DOS uses (hence notepad) \r and \n at the end of a line (ASCII 10 and ASCII 13)
    UNIX uses \n.

    Since we cannot see what is going on - all of the above is simply a guess.
    Please tell what platforms (and OS) are involved: like "the cluster" Is it a Linux cluster?
     
  10. May 16, 2016 #9

    kelvin490

    User Avatar
    Gold Member

    Yes, it's a Linux cluster and my OS is Win 8. In the cluster I use commands like pgf90 to compile the program and in my PC I use GNU or PGI Fortran. Are there any means to convert the files back to desirable format?
     
  11. May 16, 2016 #10

    Borg

    User Avatar
    Science Advisor
    Gold Member

    Try opening it in Wordpad or Notepad++. Plain old notepad is pretty bad with carriage returns from different OS's. Notepad++ is also really good with large data files. I'm currently working with a 200 Meg file using it and the file opens quickly.
     
  12. May 16, 2016 #11

    jim mcnamara

    User Avatar

    Staff: Mentor

    unix has the dos2unix and unix2dos command to reformat files. Most decent editors can do this too. Use the unix commands on the linux boxes.
     
  13. May 16, 2016 #12

    phinds

    User Avatar
    Gold Member
    2016 Award

    I agree completely about Notepad++ ... SO much better than notepad in a huge number of ways, given all the features it has
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Different format of .dat files in different software
Loading...