Created
March 17, 2015 16:27
-
-
Save yukiyan/683995a5f2f0a93bd590 to your computer and use it in GitHub Desktop.
splitして各々にヘッダ付ける
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
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