Created
December 13, 2012 18:18
-
-
Save sharat/4278435 to your computer and use it in GitHub Desktop.
convert the line endings of multiple files in a directory with the help of vi editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Convert from dos/unix to unix | |
#To convert from any mixture of CRLF endings and LF-only endings, to LF-only endings:[C 1] | |
:set hidden #Allow modified buffers to be hidden. | |
:set ffs=dos #Assume dos line endings (CRLF or LF-only) when reading files. | |
:args *.c *.h #Specify the files to convert. | |
:argdo set ff=unix|w #For each argument, set unix file format for the buffer, and write the file.[C 2] | |
#Convert from dos/unix to dos | |
#To convert from any mixture of CRLF endings and LF-only endings, to CRLF endings:[C 1] | |
:set ffs=dos #Assume dos line endings (CRLF or LF-only) when reading files. | |
:args *.c *.h #Specify the files to convert. | |
:argdo w #Write each file with CRLF line endings. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment