From: Carlos Date: 2006-03-16T18:45:51+09:00 Subject: Re: add to words syntaxes Dani wrote: > Thanks, for the answers, but didnt worked. I try to clear my problem, > Here is the input: > > 0608A; > Teszt Kft; > 33445566222; > ; > 20060101; > 20060131; > 0A0001C002A 33445566222 > 0A0001C007A Teszt kft > # this text repeat himself with other data several times > > This, should look like this: > > > > > > 0608A > > Teszt kft # the first line from the txt > 33445566222 # second line > #thrid line, in this txt is blank > > > 20060101 # fourth > 20060131 # fifth > > > > 11111111122 # and the lines... > Pr�ba C�g > ..... > > > So my problem is how can I get an XML source like above. For the columns > I already have this script: > outfile = ARGV.shift > > lines = ARGF.readlines Well, before you start to loop to fill the "mezo" tags, extract the other lines: nyomtatvanyazonosito, nev, adoszam, adoazonosito, tol, ig = lines.slice!(0,6).map {|w| w.chomp.chomp(';') } first_six_data = <<-EOT #{nyomtatvanyazonosito} #{nev} ... EOT ...And then continue processing the array as before. > marked_up_lines = lines.map do |line| > words = line.split > '' + words[1] + '' + "\n" > end > > File.open(outfile,'w') do |file| file.write first_six_data > file.write marked_up_lines.join > end HTH (warning: code not tested)