I have two files.
I want to match the 1st column of first file to 1st column of second file. If there is a match I'd like to print the 2st column of second file, if not 0.
I have tried awk (awk 'FNR==NR{a[$1]=$0;next} {print a[$1]}' 2.txt 1.txtawk 'FNR==NR{a[$1]=$0;next} {print a[$1]}' 2.txt 1.txt) but it is not working.
F1.txt
A
B
C
D
E
F
G
H
I
J
A B C D E F G H I J F2.txt
A 0.5
E 1
H 0.5
J 1
A 0.5 E 1 H 0.5 J 1 Desired_output
A 0.5
B 0
C 0
D 0
E 1
F 0
G 0
H 0.5
I 0
J 1
A 0.5 B 0 C 0 D 0 E 1 F 0 G 0 H 0.5 I 0 J 1