Re: add to words syntaxes


#1

Hi again!
Thanks for ALL your support, especially for Carlos. now it works fine!
Only one more question and I leave this theme.
What is if I in my TXT file the parameters repeat self?
So I mean:
0608A;
Teszt Kft;
33445566222;
;
20060101;
20060131;
0A0001C002A 33445566222
0A0001C007A Teszt kft

0608M
Oscar Wild
123456789
;
20060101;
20060131;
0A0001C002A 33445566222
0A0001C007A Teszt kft

etc… So I need, that on the end of the first paragraph it looks for the
second. How can I do this? With the same syntax, same file.
Regards:

Daniel


#2

Dani wrote:
[…]

second. How can I do this? With the same syntax, same file.
Regards:

Set the “input record delimiter” to “paragraph”. This is

a special case and you weren’t expected to know it beforehand :slight_smile:

original_delimiter = $/
$/ = “”

… read the “lines” (chunks of text between ) …

chunks = ARGF.readlines

… and restore the IRS to

$/ = original_delimiter

now extract individual lines from each chunk and process them as

before

chunks.each do |chunk|
lines = chunk.split($/)
… < the previous code > …
end

HTH - (not tested)