Skip to content

Instantly share code, notes, and snippets.

@yukiyan
Created March 17, 2015 16:27
Show Gist options
  • Save yukiyan/683995a5f2f0a93bd590 to your computer and use it in GitHub Desktop.
Save yukiyan/683995a5f2f0a93bd590 to your computer and use it in GitHub Desktop.
splitして各々にヘッダ付ける
class StringEditor
def concat_header(file)
open(file, 'r+') do |f|
f.puts "header\n#{open(file).read}"
end
end
def split
system "split -a 1 -l 1 hoge.txt hogehoge_"
end
def concat_each
Dir.glob('hogehoge_*') do |file|
concat_header(file)
end
end
def run
split
concat_each
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment