0

How do you verify what the delimiter for a file is?

I'm using eclipse to edit a script file on my windows system that I use to deploy on my unix server. The script specifies file names and I'd like to be certain that eclipse is saving the files with unix end of line delimiters.

I've set my preferences to use the Unix Line Delimiter on new files using:

Window > Preferences > General > Workspace > "New text file line delimiter"

And have changed my script file's line delimiter using.

File -> Convert Line Delimiters To

Is there a way (preferably with the eclipse IDE) to check that there is no "\r"?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208

1 Answers1

1

Assuming you're not using a version control system like git (which should do this automatically), you can specify which line endings to use for new files in Eclipse.

Window > Preferences > General > Workspace > "New text file line delimiter"

You can also convert an existing file by going to:

File -> Convert Line Delimiters To

In general, its best practice to always use Unix line endings for code that is being used or run on cross-platform environments.

Andrew M.
  • 10,982
  • 2
  • 34
  • 29
  • Sorry, what I was asking is how do you check what the line delimiter is. I have set the preferences a few times, but still seem to be having issues, so I wanted to verify what the delimiter has been set to. – Michael Merchant Dec 25 '10 at 04:22
  • In that case, you can use the `file` utility on *nix systems (OSX included). For Windows, I'd recommend installing cygwin and using `file` from there. – Andrew M. Dec 25 '10 at 18:28
  • thanks, the file command is useful on my mac, but it doesn't seem to work in cygwin: `bash: file: command not found` – Michael Merchant Dec 31 '10 at 00:07
  • That's because cygwin doesn't install many packages; see the following: http://cygwin.com/faq/faq.setup.html#faq.setup.what-packages – Andrew M. Dec 31 '10 at 01:10