Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = IO.open("file.txt").split(/\n/)
- for i in (0..f.length)
- if f[i].to_s.match(/regexp_a/) then
- f[i] = f[i].gsub(/regexp_b/,/regexp_c/)
- end
- end
- output = File.open("file.txt","w")
- f.each do |lines|
- output.write(lines + "\n")
- end
- output.close
Add Comment
Please, Sign In to add comment