Hi everybody (first time posting here)
I have a file1 that looks like >
1,101,0.1,0.1
1,26,0.1,0.1
1,3,0.1,0.1
1,97,0.5,0.5
1,98,8.1,0.218919
1,99,6.2,0.248
2,101,0.1,0.1
2,24,3.1,0.147619
2,25,23.5,0.559524
2,26,34,0.723404
with 762 lines..
I have another 'similar' file2 >
1,101,0.8,0.266667
1,3,0.8,0.1
1,96,83.8,13.9667
1,97,3.3,0.55
1,98,2.8,0.254545
1,99,4.4,0.22
2,101,0.1,0.1
2,24,1.3,0.108333
2,25,16.4,0.341667
2,26,30.4,0.608
with 738 lines
I want to add 'third field in file1 to third field in file2' and same thing for fourth field ...if and only if, first and second fields between them match ...
tried in bash something like..
awk -F "," '{print $1, $2}'file1 >a
awk -F "," '{print $1, $2}'file2 >b
cat a b > c
sort -u c > d
cat d | while read line
do
!!!awk
done
but I stopped at the !!!awk line...because I am not sure ...:wall:
any ideas? I know that awk is the key ...but I know just the basics of awk..
thanks in advance