filename1 = ARGV.shift filename2 = ARGV.shift f1 = File.open(filename1, 'w') f2 = File.open(filename2, 'w') lines = readlines lines.each{|line| a = line.split(/\t+/) if a.length == 2 && line.match(/^[^\t]+\t+[^\t]+$/) then f1.puts(a[0]) f2.puts(a[1]) else puts("@@@BŁĄD@@@\n#{line}") end }