Any good text editor in Windows supports saving text files using only line feeds as line endings.
To automatically convert text files from DOS / Windows to UNIX line endings, the JREPL.BAT batch file , written by Dave Benham , is a hybrid batch file / JScript file used to replace regular expressions in a file using JScript. even on Windows XP.
One file can be converted from DOS / Windows to UNIX using, for example:
jrepl.bat "\r" "" /M /F "Name of File to Modify" /O -
In this case, all carriage returns are deleted from the file for modification. Of course, it would also be possible to use "\r\n" as the search string and "\n" as the replacement string to remove only the carriage return left by the line feed if the file contains the carriage return also somewhere else that should not be removed when converting string delimiters.
Multiple files in a directory or a whole directory tree can be converted from DOS / Windows to UNIX text files using the FOR command for the CALL JREPL.BAT batch file for each file of the corresponding template template.
An example batch file for converting all * .sh files in the current directory from DOS / Windows to UNIX.
@for %%I in (*.sh) do @call "%~dp0jrepl.bat" "\r" "" /M /F "%%I" /O -
The batch file JREPL.BAT must be stored in the same directory as the batch file containing this command line.
To understand the commands used and how they work, open a command prompt window, run the following commands there and fully read all the help pages displayed for each command.
source share