如何合并多个CSV文件在Perl中?合并多个CSV文件perl
例如,我有文件1 Packet1.csv看起来像:
#type, number, info, availability
computer, t.100, pentium 2, yes
computer, t.1000, pentium 3, yes
computer, t.2000, pentium 4, no
computer, t.3000, pentium 5, yes
和文件2 Packet2.csv看起来像:
#type, number, info, availability
computer, t.100, pentium 2, yes
computer, t.1000, pentium 3, no
computer, t.2000, pentium 4, no
computer, t.4000, pentium 6, no
,我想要的输出是一个单个文件所在数数据包不固定:
#type, number, info, **Packet1** availability, **Packet2** availability
computer, t.100, pentium 2, yes, yes
computer, t.1000, pentium 3, yes, no
computer, t.2000, pentium 4, no, no
computer, t.3000, pentium 5, yes
computer, t.4000, pentium 6, no
你有多少数据?将所有内容加载到内存中是否可行?您的输入是否总是按照示例排序? – pmakholm
@Tim N我曾尝试使用多维哈希 – TheBlackCorsair
@TheBlackCorsair它为什么不工作? – Tim