Skip to content

Instantly share code, notes, and snippets.

@fj
Created March 7, 2009 21:58
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 fj/75464 to your computer and use it in GitHub Desktop.
Save fj/75464 to your computer and use it in GitHub Desktop.
# Removes all Unicode BOMs from files and converts Windows CRLF to Unix LF.
find . -type f | \
while read line; \
do \
hd "$line" | grep -q 'ef bb bf' && echo "$line"; \
done | \
while read line; \
do \
echo [[[ $line; \
dd if=$line of=$line.result ibs=3 skip=1; \
diff $line $line.result; \
dos2unix -v $line.result; \
mv -v $line.result $line; \
echo ]]]; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment