Input: two tab-delimited files, File1
and File2
. File2
($2
) has to be parsed by patterns found in File1
($1
).
Expected output: tab-delimited file, File3
. File3
has to contain the same rows as File2
, plus the corresponding value in File1
if the pattern is matched (end of the line, tab-separated).
File1 (tab-delimited):
ABC1 1 3
ABC2 4 3
ABC3 3 2
ABC4 3 3
File2 (tab-delimited):
text1 ABC1-AB text2 text3
text2 ABC2-AB text1
text3 ABC1-CD text2
text4 ABC5-AB text3 text4
File3:
text1 ABC1-AB text2 text3 1 3
text2 ABC2-AB text1 4 3
text3 ABC1-CD text2 1 3
text4 ABC5-AB text3 text4