On Feb 6, 8:36 am, Drew Olson <olso... / gmail.com> wrote:
> I think he wants to append this array with information each time he sees
> the same key [...]

So here's another version:

lookup = Hash.new{ |h,k| h[k]=[] }

DATA.each_line{ |line|
  line.chomp!
  warn "No key in '#{line}'" unless key = line[ /\bE\w+/ ]
  lookup[ key ] << line
}

p lookup[ "E050441" ]
#=> ["AP850SDA;INCLIB;E050441;AP013;240107;0730",
"AP850SDS;INCLIB;E050441;AP013;240107;0730"]

require 'pp'
pp lookup
#=> {"E050441"=>
#=>   ["AP850SDA;INCLIB;E050441;AP013;240107;0730",
#=>    "AP850SDS;INCLIB;E050441;AP013;240107;0730"],
#=>  "E052337"=>
#=>   ["AP850SD$;INCLIB;E052337;AP013;240107;0730",
#=>    "AP850SDO;INCLIB;E052337;AP013;240107;0730"],
#=>  "E023889"=>
#=>   ["AP850KP;INCLIB;E023889;AP013;240107;0730",
#=>    "AP850SDI;INCLIB;E023889;AP013;240107;0730"]}

__END__
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