Finding pesky \r\n source files
LIke many developers, having come from a Windows environment in a deep, dark time long, long ago, getting rid of \r\n line endings from source has become a personal quest of mine, usually found in my older projects (and sometimes in the odd piece of 3rd party code).
The following alias is handy for this quest of mine:
alias findcrlf='grep -lIUrP "\r" .'
Coupling this with Git (you use Git, right?) is the following core config setting to help things along:
git config --global core.autocrlf "input"
Note: -P means grep uses PCRE for matching, which grep implementations often list as "highly experimental", but I haven't seen any issues personally with this.
Happy \r\n squashin!
Written by Peter Mescalchin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Related Tags
#shell
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#