我有两个 CSV 文件需要帮助映射/合并:
CSV 文件 1:
"ID","Name","Flavor"
"45fc754d-6a9b-4bde-b7ad-be91ae60f582","test1","m1.medium"
"83dbc739-e436-4c9f-a561-c5b40a3a6da5","test2","m1.tiny"
"ef68fcf3-f624-416d-a59b-bb8f1aa2a769","test3","m1.medium"
CSV 文件 2:
"Name","RAM","Disk","VCPUs"
"m1.medium",4096,40,2
"m1.xlarge",16384,160,8
"m1.tiny",128,1,1
理想的输出是:
"ID","Name","Flavor","RAM","Disk","VCPUs"
"45fc754d-6a9b-4bde-b7ad-be91ae60f582","test1","m1.medium",4096,40,2
"83dbc739-e436-4c9f-a561-c5b40a3a6da5","test2","m1.tiny",128,1,1
"ef68fcf3-f624-416d-a59b-bb8f1aa2a769","test3","m1.medium",4096,40,2
请注意,Flavor在 CSV 文件 1 中和Name在 CSV 文件 2 中是相同的。名称上的差异是用于提取信息的不同工具的结果。
另请注意,CSV File2 有一个flavor/name m1.xlarge. 如上所述,如果m1.xlarge flavor/name在 CSV File1 中未找到 ,则应将其从合并输出中丢弃。
我整天都在做这件事,结果好坏参半。任何想法,将不胜感激。
斯蒂芬大帝
白猪掌柜的
撒科打诨
相关分类