Hi,
I have seen many posts on this and made progress but did not find a post that solves an issue I still have.
I have 2 files (actually more than 2 but I want to do them 2 by 2, however if you know how to do all of them at the same time that would be great) with 7 columns each. each file does not have the same number of lines so even sorting wouldn't work for the "join" unix command I believe.
So I tried the NR==FNR awk command
awk FNR==NR{a[$1];next}($1 in a){print}' OFS=\\t file1.tabular.txt file2.tabular.txt > outputfile.tabular.txt
this only gives me the complete line of one of the 2 files
then
awk FNR==NR{a[$1]=$3 ;next}($1 in a){print $1,$3,$7,a[$1]}' OFS=\\t file1.tabular.txt file2.tabular.txt > outputfile.tabular.txt
This is better, I get only the columns I want from one file but only one additional column from the second file.
I tried replacing with $0 for the first a[$1] but then I get the whole line, I don t know how to extract the 2 columns I want from it. Could you help me?
thanks a lot,
best regards
