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:
> 
> <?xml version="1.0" encoding="windows-1250"?>
> <nyomtatvanyok>
>   <nyomtatvany>
>     <nyomtatvanyinformacio>
>       <nyomtatvanyazonosito>0608A</nyomtatvanyazonosito>
>       <adozo>
>         <nev>Teszt kft</nev> # the first line from the txt
>         <adoszam>33445566222</adoszam> # second line
>         <adoazonosito></adoazonosito> #thrid line, in this txt is blank
>       </adozo>
>       <idoszak>
>         <tol>20060101</tol> # fourth
>         <ig>20060131</ig> # fifth
>       </idoszak>
>     </nyomtatvanyinformacio>
>     <mezok>
>       <mezo eazon="0A0001C002A">11111111122</mezo> # and the lines...
>       <mezo eazon="0A0001C007A">Pra CñÈ</mezo>
> .....
> </mezok></nyomtatvany></nyomtatvanyok>
> 
> 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
<?xml ...
<nyomtatvanyinformacio>
   <nyomtatvanyazonosito>#{nyomtatvanyazonosito}</nyomtatvanyazonosito>
      <adozo>
        <nev>#{nev}</nev>
  ...
EOT

...And then continue processing the array as before.

> marked_up_lines = lines.map do |line|
>   words = line.split
>   '<mezo eazon="' + words[0] + '">' + words[1] + '</mezo>' + "\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)