Last active
December 15, 2021 14:04
-
-
Save jinjagit/ae6a5083ba12f0a5b10d28d754151ce1 to your computer and use it in GitHub Desktop.
Useful template for file sanitization needs
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
# Strips single quotes from a file, line by line. | |
# Useful template for other sanitization needs. | |
lines =[] | |
File.readlines('some_file.csv').each do |line| | |
lines << line | |
end | |
File.open("some_file.csv", "w") { |f| | |
lines.each do |line| | |
f << line.gsub("'", "") | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment