-
-
Save anonymous/05f67b7f40c695bd0d67 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/ruby | |
IDS=[] | |
IDS_t=[] | |
IDS_t = File.readlines("id_to_change_uniq") | |
IDS=IDS_t.map(&:chomp) | |
new_ID="" | |
File.open("binlog-restore-20150614-1230-ruby").each do |line| | |
if line =~ /INSERT INTO|DELETE|UPDATE|INSERT_ID/ | |
ID = IDS.find { |w| line =~ /#{w}/ } | |
puts line | |
p ID | |
new_ID = ID.to_i + 1000 | |
p new_ID | |
line.gsub(/#{ID}/,"#{new_ID}") | |
puts line | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment