Created
September 13, 2012 05:44
-
-
Save suruseas/3712140 to your computer and use it in GitHub Desktop.
\xxx\xxxの8進数形式で文字が表記されているテキストをそのままバイナリ変換して新たにファイルに保存する
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
while argv = ARGV.shift | |
File::open(argv, "r") do |rf| | |
File::open("#{File::realpath(rf)}.cnv", "w") do |wf| | |
while line = rf.gets | |
wf.puts line.gsub(/\\([0-9]+)/){ | |
[$1.oct].pack("C*") | |
} | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment