-
Notifications
You must be signed in to change notification settings - Fork 767
Dos2Unix Text file format converters
James edited this page Oct 19, 2015
·
6 revisions
The EOL (End Of Line) character in DOS is '\r\n'
The EOL (End Of Line) character in UNIX is '\n'
Editing UNIX files on Windows changes the EOL from UNIX to DOS, which might make the UNIX build tools not working. Also this make file comparison difficult. Use the following steps to batch convert files from DOS to UNIX EOL:
Using PowerShell
Get-ChildItem -File -Recurse | % { $x = get-content -raw -path $_.fullname; $x -replace "`r`n","`n" | set-content -path $_.fullname }
or
- Download dos2unix.exe program from http://sourceforge.net/projects/dos2unix/?source=typ_redirect
- Uncompress the compressed file (lets say, dos2unix-7.3-win32.zip)
- Put the bin directory of the uncompressed file (that has dos2unix.exe and other programs) in system path
- Open a command shell and go to the directory where you want to convert files and run
// to convert all files
for /R %G in (*.*) do dos2unix "%G"
// to convert all .h files
for /R %G in (*.h) do dos2unix "%G"
// to convert all .c files
for /R %G in (*.c) do dos2unix "%G"
- MSI Install Instructions
- Script Install Instructions
- Alternative installation using the universal installer
- Retrieving download links for the latest packages