I am having two files fileone and filetwo as below:
fileone:
a 0 0
b 4 3
c 3 2
f 3 2
filetwo:
a 3
b 2
f 2
If column1 from fileone and column1 from filetwo are matcing then I need to append the column2 from filetwo to fileone as below:
Output:
a 0 0 3
b 4 3 2
c 3 2
f 3 2 2
I tried this but not getting the desired output:
#!/bin/bash
echo "These reports are based on this run:" ; pwd
echo " " ;
awk -F, 'FNR==NR {a[$1]; next}; $1 in a' fileone filetwo