I've got two files (millions of columns)
File1.txt, ~4k rows
some_key1 some_text1
some_key2 some_text2
...
some_keyn some_textn
File2.txt, ~20 M rows
some_key11 some_key11 some_text1
some_key22 some_key22 some_text2
...
some_keynn some_keynn some_textn
When there is an exact match between column 2 in File1.txt
and column 3 in File2.txt
, I want to print out the particular rows from both files.
EDIT
I've tried this (I forgot to write it) but it doesn't work
awk 'NR{a[$2]}==FNR{b[$3]}'$1 in a{print $1}' file1.txt file2.txt
awk 'NR{a[$2]}==FNR{b[$3]}'$1 in a{print $1}'
which has 3 single quotes in it:awk 'NR...}'$1...}'
. Obviously you can't have a [unescaped] character in the middle of a string or script that's delimited by that character so - what were you hoping the single quote in the middle would mean? What you have is like writing an English sentence likeHe said "here is"the answer" to me
. It doesn't make sense to have"
in the middle of a"
-delimited statement and that's true for any given character so what was your intent with the'
mid-script? – Ed Morton