Reading DOS or Linux text files

In order to have nice integration between Windows desktops and our Linux cluster I write wrapper scripts to run ‘dos2unix controlfile.uci tempfile.uci’ and then run the Linux program with tempfile.uci as input. This works, but it is now starting to get complicated. I now have to open ‘tempfile.uci’ and extract out further supplementary files that also require ‘dos2unix’.

I was hoping for a compilation flag, but I have been unable to find anything, except for ‘run dos2unix…’.

Any ideas?

Kindest regards,
Tim

I forgot to mention, I use the pgf95 compiler.

Hi Tim,

Try setting the environment variable “FORTRANOPT” to “crlf”. This should adjust the I/O to read in either “\n” or “\c\l”.

Hope this helps,
Mat

Excellent! Thanks!

Now I did try this - sort of.

In the User’s Guide http://www.pgroup.com/doc/pgiug.pdf it says ‘FORTRAN_OPT’ and crif. Of course this didn’t work. I then tried ‘crlf’ and this didn’t work either.

I am happy that I have a solution that will solve many problems for me.

Comments:

  1. Fix the User’s Guide, please.
  2. I would suggest that ‘crlf’ should be the default.
  3. Though this isn’t a direct concern of mine, would be nice to handle Mac files also.

Hi Tim,

In the User’s Guide > http://www.pgroup.com/doc/pgiug.pdf > it says ‘FORTRAN_OPT’ and crif. Of course this didn’t work. I then tried ‘crlf’ and this didn’t work either.

Sorry about that. I noticed these two typos as well and reported them to our docs person. It should be fixed in the 8.1 User’s Guide.

  • Mat

Hi Tim,

I would suggest that ‘crlf’ should be the default.

I asked our chief compiler architect about this. He said they had considered making this the default awhile ago. However, since ‘crlf’ is a legitimate character sequence on Linux that does not always mean the same thing as newline, changing the default would have potentially adverse effects.

  • Mat