Jan 202010
Join lines on a common field
Answer:
Suppose you have two files
file1.txt
john b
mark c
peter a
file2.txt
john 2
mark 3
peter 1
You can to join two files by the first column, to become
john b 2
mark c 3
peter a 1
It is easy with the join command
# join file1.txt file2.txt
Remark: You would need to sort the file and make each column an unique line first.