Created
April 3, 2013 13:58
-
-
Save trcook/5301416 to your computer and use it in GitHub Desktop.
regex hash
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
| my_input=File.open("my_input.txt","r") # load some file as type: File | |
| fixb=Hash.new | |
| fixb.merge! "\t" => "&", | |
| "\n"=>"\\\\"+"\\\\"+"\n", | |
| "\""=>"" | |
| my_output=my_input.read.to_s | |
| fixb.each_pair do |key, val| | |
| my_output.gsub!(key,val) | |
| end | |
| IO.write('my_file_out.tex', my_output ) # Writes the file | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment