Created
August 17, 2012 15:24
-
-
Save jeffreybaird/3379856 to your computer and use it in GitHub Desktop.
Script to cleanup the cap production marketing:sources output
This file contains hidden or 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
| #create a file (here called "file.txt") to paste the cap output into, run this file to clean the output. | |
| require 'fileutils' | |
| require 'tempfile' | |
| t_file = Tempfile.new('sources.txt') | |
| File.open("file.txt", 'r+') do |f| | |
| f.each_line do |line| | |
| line = line.to_s | |
| line = line.strip | |
| line = line.gsub(line.slice(0..30),"") | |
| t_file.puts line if line.length > 2 | |
| end | |
| end | |
| FileUtils.mv(t_file.path, "sources.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment