Created
February 10, 2009 20:07
-
-
Save davidbody/61565 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# Finds all files in app directory that have CRLF line endings | |
# and converts them to LF line endings by removing all of the CR (\r) characters. | |
files = %x{find app -exec file {} \\; | grep CRLF}.map{|s| s.gsub(/:.*$/, '').strip} | |
files.each do |f| | |
puts "Processing #{f}" | |
system "tr -d '\\r' < #{f} > #{f}.new" | |
system "mv #{f}.new #{f}" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment