Advertisement
babusha

Untitled

Jun 5th, 2011
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.35 KB | None | 0 0
  1. #!/usr/bin/ruby -Ku
  2.  
  3. linesCount = 0
  4. filesNumber = 1
  5. File.new "text#{filesNumber}.txt",'w'
  6. File.open(file).readlines.each do |line|
  7.         if linesCount == 5
  8.             linesCount = 0
  9.             filesNumber += 1
  10.             File.new "text#{filesNumber}.txt",'w'
  11.         end
  12.        
  13.         File.open("text#{filesNumber}.txt",'w') do |line2|
  14.             line2.puts line
  15.             linesCount += 1
  16.         end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement