-
-
Save anonymous/4a2dbf4babc1d007d6c0 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
ids_t=[] | |
ids_t = File.readlines("id_to_change_all_uniq") | |
ids=ids_t.map(&:chomp) | |
new_id="" | |
file2 = open("dump-to-database-yshop", 'w') | |
File.open("yshop_14-megaslice").each do |line| | |
if ( id = ids.find { |w| line =~ /\b#{w}\b/ } ) | |
new_id = id.to_i + 10000 | |
line.gsub!(/\b#{id}\b/,"#{new_id}") | |
file2.write(line) | |
else | |
file2.write(line) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment