Created
September 13, 2017 10:27
-
-
Save detunized/f7edcc0b4fa3a17feebb95ef915d8c4a to your computer and use it in GitHub Desktop.
Split binary file on hex pattern
This file contains hidden or 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
File.binread("filename.bin").split(/(?=\x15\x01)/).each_with_index do |data, i| | |
File.open("filename-%02d.bin" % i, "wb") do |io| | |
io.write data | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment