Skip to content

Instantly share code, notes, and snippets.

@panozzaj
Created April 13, 2015 22:28
Show Gist options
  • Select an option

  • Save panozzaj/a554cd748827c50243a3 to your computer and use it in GitHub Desktop.

Select an option

Save panozzaj/a554cd748827c50243a3 to your computer and use it in GitHub Desktop.

Revisions

  1. panozzaj created this gist Apr 13, 2015.
    22 changes: 22 additions & 0 deletions convert.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/usr/bin/env ruby

    # Takes a NEO import and converts it into more readable files and filenames

    require 'fileutils'

    (1..8).to_a.each do |filenum|
    filename = "File #0#{filenum}.txt"
    if File.exist?(filename)
    FileUtils.cp filename, "#{filenum}.txt"
    end
    end

    (1..8).to_a.each do |filenum|
    filename = "#{filenum}.txt"
    if File.exist?(filename)
    lines = File.read(filename).split(/\r/)
    File.open(filename, 'w') do |f|
    f.puts lines.join("\n")
    end
    end
    end