Note that there are some explanatory texts on larger screens.

plurals
  1. POawk-sed joining of 3 tables with one nearly identical column... surely easier than python
    text
    copied!<p>I have a rather monolithic database I am re-building at the moment, and I want to join 3 tables with semi-matching content, I have several sets of these but they all come in groups of three. Here is the situation:</p> <p>--note all tables are in ascii format, space deliminated ---</p> <p>T1_01= Table 1 = </p> <pre><code>1 + 'stuff1' + additional content 1 (where additional content only sometimes available) 2 "" 3 "" ....400 </code></pre> <p>T1_02= Table 2 = </p> <pre><code>1 + "different stuff" + additional content 2 2 "" 3 "" ... 400 </code></pre> <p>T1_03 = Table 3 = </p> <pre><code>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 </code></pre> <p>what I want, for each 'group' I have 3 tables, since these are grouped in a handy fashion, ie T1_01, T1_02, T1_03 would be table 1,2,3 for group 1, and again for T2_01,T2_02,T2_03. I need to do this about 60 times in total and the table output I am hoping for is:</p> <p>T1_0123=</p> <pre><code>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 "" </code></pre> <p>now I did an initial run and </p> <p><code>join -1 1 -2 1 T1_01 T1_02 &gt; T1_012</code> works great, but only does the first two and</p> <p><code>join -1 1 -2 6 T1_01 T1_03</code> ... does not work since 001 is not 1</p> <p>and I was hoping to run all 3 tables in a go then do something like <code>sed something awk $(cat list_of_T01) $(cat list_of_T02) $(cat list_of_T03)</code> to run as a batch job. I have been learning python so this may be possible there as well, but I surely AWK is easier? Any suggestions are welcome. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload