Convert text file line endings between Windows CR/LF and Linux/Mac OS X format with a free open source command line tool for Windows, Mac OS X and Linux.

command line examples with sfk:

sfk remcr mybatch

converts the single file mybatch

sfk remcr . .txt

converts all .txt files in the current directory
AND in all subdirectories.

sfk remcr -dir FooBank -file .hpp

converts all .hpp files in the directory tree FooBank.

sfk addcr -dir . -file .txt -norec

changes LF endings into CR/LF for Windows,
on all .txt files of the current directory,
but NOT within subdirectories (no recursion).
to find out if a file contains LF or CRLF line endings, you may use the command:
sfk hexdump -showle testfile.txt

example output:

testfile.txt :
 >6C697374 206F6620 66696C65 7320636F< list of files co 00000000
 >6E746169 6E696E67 20746162 733A0D0A< ntaining tabs:.. 00000010
 >74657374 66696C65 735C466F 726D6174< testfiles\Format 00000020
 >735C3031 2D6E6174 6976652D 7461622D< s\01-native-tab- 00000030
 >63726C66 2E747874 0D0A7465 73746669< crlf.txt..testfi 00000040
 >6C65735C 466F726D 6174735C 30322D63< les\Formats\02-c 00000050
 >726C662E 7478740D 0A746573 7466696C< rlf.txt..testfil 00000060
 >65735C46 6F726D61 74735C30 332D6E61< es\Formats\03-na 00000070
 >74697665 2D746162 2D6C662E 7478740D< tive-tab-lf.txt. 00000080
 >0A746573 7466696C 65735C46 6F726D61< .testfiles\Forma 00000090
 >74735C30 342D6C66 2E747874 0D0A7465< ts\04-lf.txt..te 000000a0
 >73746669 6C65735C 466F726D 6174735C< stfiles\Formats\ 000000b0
 >30382D68 6561642D 7461696C 2E747874< 08-head-tail.txt 000000c0
 >0D0A7465 73746669 6C65735C 466F726D< ..testfiles\Form 000000d0
 >6174735C 32302D74 61622D64 6174612D< ats\20-tab-data- 000000e0
 >6C696E65 2E747874 0D0A3620 66696C65< line.txt..6 file 000000f0
 >73206F66 20333220 636F6E74 61696E20< s of 32 contain  00000100
 >74616273 2E0D0A<                     tabs...          00000110
   in this example, we see that the file contains CR/LF line endings (or 0x0D0A),
   i.e. it has DOS/windows format. to convert it into a linux-compliant format,
   we run the command
sfk remcr testfile.txt
   afterwards, the same hexdump command produces this:
testfile.txt :
 >6C697374 206F6620 66696C65 7320636F< list of files co 00000000
 >6E746169 6E696E67 20746162 733A0A74< ntaining tabs:.t 00000010
 >65737466 696C6573 5C466F72 6D617473< estfiles\Formats 00000020
 >5C30312D 6E617469 76652D74 61622D63< \01-native-tab-c 00000030
 >726C662E 7478740A 74657374 66696C65< rlf.txt.testfile 00000040
 >735C466F 726D6174 735C3032 2D63726C< s\Formats\02-crl 00000050
 >662E7478 740A7465 73746669 6C65735C< f.txt.testfiles\ 00000060
 >466F726D 6174735C 30332D6E 61746976< Formats\03-nativ 00000070
 >652D7461 622D6C66 2E747874 0A746573< e-tab-lf.txt.tes 00000080
 >7466696C 65735C46 6F726D61 74735C30< tfiles\Formats\0 00000090
 >342D6C66 2E747874 0A746573 7466696C< 4-lf.txt.testfil 000000a0
 >65735C46 6F726D61 74735C30 382D6865< es\Formats\08-he 000000b0
 >61642D74 61696C2E 7478740A 74657374< ad-tail.txt.test 000000c0
 >66696C65 735C466F 726D6174 735C3230< files\Formats\20 000000d0
 >2D746162 2D646174 612D6C69 6E652E74< -tab-data-line.t 000000e0
 >78740A36 2066696C 6573206F 66203332< xt.6 files of 32 000000f0
 >20636F6E 7461696E 20746162 732E0A<    contain tabs..  00000100