Created
November 27, 2015 09:01
-
-
Save goodjob1114/b9f9541e2895c189c387 to your computer and use it in GitHub Desktop.
read csv and write to file (append)
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
IO.foreach("./test.csv") do |line| | |
# Remove trailing whitespace. | |
line.chomp! | |
# Split on comma. | |
values = line.split(",") | |
# Write results. | |
IO.write("/tmp/testfile", values.join("+") << "... " << String(values.length) << "\n", mode: 'a') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment