Skip to content

Instantly share code, notes, and snippets.

@dpeek
Created February 11, 2019 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpeek/81ae18d29b1b7a97ae1d69395b7828aa to your computer and use it in GitHub Desktop.
Save dpeek/81ae18d29b1b7a97ae1d69395b7828aa to your computer and use it in GitHub Desktop.
Ensure consistent line-endings within files (both CRLF and LF)
# 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