5

matching columns

view full story
linux-howto

http://www.unix.com – Hello experts, I have this problem, I need to match values based on two files, this is what I have: file1 Code: 1.1 1.2 1.3 5.5 1.4 1.5 1.6 file2 Code: 1 a 2 B 3 C 4 D 5 z 6 F 7 G 8 H 9 I 10 J 11 K 12 L 13 M 14 N 15 O 16 P 17 Q 18 R 19 S 20 T and the desired output is: Code: a a a z a a a I'm using this code: Code: awk 'NR==FNR{a[int($1+.5)];next} $1 in a {print $2}' file1 file2 but I just get this: Code: a z this is :wall: how could I modify the code above to get what I want? any help is very grateful, Thanks in advance (HowTos)