我有两个数据库(txt文件)。一个是两列,以制表符分隔,包含名称和ID。你知道吗
name1 \t ID1
name1 \t ID2
name2 \t ID9
name2 \t ID40
name3 \t ID3
另一个数据库与第一列中的第一个数据库具有相同的ID,而第二列列出了由逗号分隔的相同类型的ID(这些ID是第一个数据库中ID的子项,因为第二个数据库是分层的)。你知道吗
ID1 \t ID1,ID2,ID3
ID2 \t ID2, ID9
我想做的是得到第三个与第二个相同格式的数据库,但是在第二列中,我想将子ID替换为第一个数据库的名称。例如:
ID1 \t name1,name2,name3
ID2 \t name1,name2
有办法吗?我是个初学者,在使用web服务之前我必须映射ID,但这是一种需要进一步分析的自定义格式,我不知道从哪里开始。你知道吗
提前谢谢!你知道吗
您可以尝试以下单行awk脚本:
“文件”_名称.txt对于awk,是txt文件,其第一列有“name1,name2…”,而文件ID.txt在第一列中有“ID1,ID2,…”
sed将删除列表开头和结尾不需要的逗号。你知道吗
相关问题 更多 >
编程相关推荐