Created
February 11, 2019 18:37
-
-
Save dpeek/81ae18d29b1b7a97ae1d69395b7828aa to your computer and use it in GitHub Desktop.
Ensure consistent line-endings within files (both CRLF and LF)
This file contains hidden or 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
# Require Swiss File Knife (sfk) (available from homebrew on macOS) | |
# find all files detected as CRLF and force CRLF | |
find . -not -path "./.git*" -type f | xargs file | grep "CRLF" | awk -F ':' '{ print $1 }' | xargs sfk addcr | |
# find all files detected as LF and force LF | |
find . -not -path "./.git*" -type f | xargs file | grep -v "CRLF" | awk -F ':' '{ print $1 }' | xargs sfk remcr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment