Skip to content

Instantly share code, notes, and snippets.

@lee-dohm
Last active December 18, 2015 07:10
Show Gist options
  • Save lee-dohm/5745075 to your computer and use it in GitHub Desktop.
Save lee-dohm/5745075 to your computer and use it in GitHub Desktop.
Code samples for blog article: "Text File Line Endings"
Get-Content -Encoding byte test.rb
lines = nil
File.open(__FILE__, 'r') do |file|
lines = file.readlines
end
lines.each do |line|
puts line.bytes.map { |b| "%02X" % b }.join(' ')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment