i have two files with columns sorted by the value of the first column, and i want to merge them only if the value of the second exists in the first one.
The first file is like this
man01 xxx yyy zzz
man02 xxx yyy zzz
man03 xxx yyy zzz
man04 xxx yyy zzz
The second file
man01 sss
man08 sss
And the desired output is
man01 xxx yyy zzz sss
man02 xxx yyy zzz
man03 xxx yyy zzz
man04 xxx yyy zzz
I tried join but requires values of second file exist in the first one :/
Join can do this, have you considered the -a
option ? It will produce a line for each unpairable file line in a.txt and b.txt.
join -a1 a.txt b.txt
man01 xxx yyy zzz sss
man02 xxx yyy zzz
man03 xxx yyy zzz
man04 xxx yyy zzz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With