R
Rebhan, Gilbert
Hi,
<newbie>
i have a txtfile with a format like that =3D
AP850KP;INCLIB;E023889;AP013;240107;0730
AP850SD$;INCLIB;E052337;AP013;240107;0730
AP850SDA;INCLIB;E050441;AP013;240107;0730
AP850SDI;INCLIB;E023889;AP013;240107;0730
AP850SDO;INCLIB;E052337;AP013;240107;0730
AP850SDS;INCLIB;E050441;AP013;240107;0730
...
i want to get a collection for every E followed by digits,
so with the example above, i want to get =3D
collections:
E023889
E052337
E050441
...
each collection should contain datasets with the rest of the line, so
f.e.
E023889 would have =3D
[AP850KP;INCLIB;AP013;240107;0730,AP850SDI;AP013;240107;0730]
questions=3D
what kind of collection is the best ? is an array sufficient ?
right now i have =3D
efas=3DArray.new
File.open("mycsvfile", "r").each do |line|
if line =3D~ /(\w+.?);(\w+);(\w+);(\w+);(\w+);(\w+)/
=20
efas<<$3.to_s<<',' unless efas.include?($3.to_s)
=20
end
end
puts efas.to_s.chop
So i have all Ed\+, but how to get further ?
Are there better ways as regular expressions ?
Any ideas ?
<newbie/>
Regards, Gilbert
<newbie>
i have a txtfile with a format like that =3D
AP850KP;INCLIB;E023889;AP013;240107;0730
AP850SD$;INCLIB;E052337;AP013;240107;0730
AP850SDA;INCLIB;E050441;AP013;240107;0730
AP850SDI;INCLIB;E023889;AP013;240107;0730
AP850SDO;INCLIB;E052337;AP013;240107;0730
AP850SDS;INCLIB;E050441;AP013;240107;0730
...
i want to get a collection for every E followed by digits,
so with the example above, i want to get =3D
collections:
E023889
E052337
E050441
...
each collection should contain datasets with the rest of the line, so
f.e.
E023889 would have =3D
[AP850KP;INCLIB;AP013;240107;0730,AP850SDI;AP013;240107;0730]
questions=3D
what kind of collection is the best ? is an array sufficient ?
right now i have =3D
efas=3DArray.new
File.open("mycsvfile", "r").each do |line|
if line =3D~ /(\w+.?);(\w+);(\w+);(\w+);(\w+);(\w+)/
=20
efas<<$3.to_s<<',' unless efas.include?($3.to_s)
=20
end
end
puts efas.to_s.chop
So i have all Ed\+, but how to get further ?
Are there better ways as regular expressions ?
Any ideas ?
<newbie/>
Regards, Gilbert