更容易加入我有一個相當單片數據庫我建設重的那一刻,我想加入半匹配內容的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