Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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"?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 4: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 0:07
    
That's because cygwin doesn't install many packages; see the following: cygwin.com/faq/faq.setup.html#faq.setup.what-packages –  Andrew M. Dec 31 '10 at 1:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.