Re: add to words syntaxes

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"?> 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
marked_up_lines = lines.map do |line|
words = line.split
‘’ + words[1] + ‘’ + “\n”
end

File.open(outfile,‘w’) do |file|
file.write marked_up_lines.join
end

This works fine, but I dont know what to do with the first 6 lines to
bring it to look like above and how can I bring ruby to repeat himself
and what for a character need I to use for repeating…
Regards,

Daniel

Dani wrote:

0A0001C007A Teszt kft
Teszt kft # the first line from the txt
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

<?xml ... #{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)