Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Convert CRLF’s to line feeds on Linux

I have several scripts that produce a /bin/sh^M bad interpreter error message when they are run. I believe this is because they are formatted with the Windows/DOS line termination instead of the line termination expected by Unix/Linux (Ubuntu 9.04 for an embedded system in my case).

Is there an easy way to convert text files from the Windows/DOS format to the Unix format in a Linux environment?

share|improve this question

marked as duplicate by Diago Oct 9 '09 at 5:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
same question with some alternate answers: superuser.com/questions/52044/… –  quack quixote Oct 8 '09 at 21:04
add comment

2 Answers

up vote 3 down vote accepted

Multiple choices here:

How do I convert between Unix and Windows text files?

share|improve this answer
    
That page claims this about the dos2unix tools: "These utilities are available only on Solaris systems." This answer explains how to get similar tools in Linux environment: superuser.com/questions/52044/… –  Jonik Oct 7 '09 at 10:07
add comment

You can use the dos2unix utility for this.

dos2unix winfile.txt unixfile.txt
share|improve this answer
1  
Dammit! I wrote an app to do this for me in C#. Then again, it also converted ANSI to Unicode and back again, so it wasn't a complete waste. +1 –  user3463 Sep 10 '09 at 11:25
1  
@randolph: you implemented iconv in C#? –  quack quixote Oct 7 '09 at 12:12
add comment

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