更容易加入我有一个相当单片数据库我建设重的那一刻,我想加入半匹配内容的3个表,我有几套这些,但他们都是三个一组。这里的情况是:AWK-sed的3个表有一个几乎相同的列...肯定比蟒蛇
- 注所有表是ASCII格式,deliminated空间---
T1_01 =表1 =
1 + 'stuff1' + additional content 1 (where additional content only sometimes available)
2 ""
3 ""
....400
T1_02 =表2 =
1 + "different stuff" + additional content 2
2 ""
3 ""
... 400
T1_03 =表3 =
5 cols yet other stuff + 001 + additional content 3
5 cols yet other stuff + 003 ""
5 cols yet other stuff + 007 ""
...
5 cols yet other stuff + 399 some rows are skipped, varies which ones
5 cols yet other stuff + 400
我想,每一个“组”我有3个表,因为这些都在一个方便的方式分组,即T1_01,T1_02,T1_03将为T2_01,T2_02,T2_03是表1,2,3组1,并再次。我总共需要做这个约60倍和表格输出,我希望的是:
T1_=
1 + 'stuff1' + additional content 1 1 + "different stuff" + additional content 2 5 cols yet other stuff + 001 + additional content 3
2 + 'stuff1' + additional content 1 2 + "different stuff" + additional content 2 "something to fill in the empty spaces, like a set of -99.9 values"
3 + 'stuff1' + additional content 1 3 + "different stuff" + additional content 2 5 cols yet other stuff + 003 + additional content 3
...
400 ""
现在我做了一个初始运行和
join -1 1 -2 1 T1_01 T1_02 > T1_012
的伟大工程,但只做前两个 和
join -1 1 -2 6 T1_01 T1_03
...因为001不工作是不是1
和我希望能运行在一个去,然后像做 sed something awk $(cat list_of_T01) $(cat list_of_T02) $(cat list_of_T03)
作为批处理作业运行的所有3个表。我一直在学习python,所以这可能在那里,但我肯定AWK更容易?欢迎任何建议。
有时解释给陌生人一个问题,提示从提问的回答。我希望这是你的情况。否则,请显示真实表格和预期结果的示例。 – potong 2012-08-13 07:01:46