Hi ,
I have two files.
file-1 named "countNeigbor.txt" have 4 columns, --- column 1 has its corresponding value in column 4
file-2 names "countSR.txt", have 3 columns, ----- column 1 values == column 1 values of file-1 but it repeates .
file-2 : column 1 has its correspondance reference with file-2 column 2
-----------------------
file-1 -- total values are upto 101 (column-1), its just a sample.
0 44 316 7.18182
1 46 372 8.08696
2 47 570 12.1277
3 47 626 13.3191
4 50 1335 26.7
5 41 633 15.439
6 50 1094 21.88
7 45 602 13.3778
8 48 1066 22.2083
9 42 581 13.8333
.
.
.
101 45 303 6.73333
-----------------
file-2, its is just a sample there are 5856 records correponds to column 2. column 2 has unique value, no repeatition.
98 2621 2
44 2622 14
2 2623 19
56 2624 9
95 2625 9
68 2627 8
.
.
.
81 3943 26
56 2163 14
100 2164 37
100 3945 31
13 2165 14
89 3946 35
68 2166 8
37 3947 26
35 3948 20
43 2168 1
87 3949 26
0 2620 11
.........
I need the output as like for every record for file-2 by extracting corresponding values from file-1.
98 2621 2 itsValue
2 2623 19 12.1277
.
.
.
2 1020 20 12.1277
.
.
..........
in file-2 as 1st column values repeats e.g. 2 repeats but its correponding value in file-1 remains the same. So i want to put as I display it above.
Thanks for understanding.
I have tried hard, searching on google, on this forum as well, how getline, FILENAME etc works in awk, using arrays, but fail to come to result.
Thanks in advance for your help.
I have two files.
file-1 named "countNeigbor.txt" have 4 columns, --- column 1 has its corresponding value in column 4
file-2 names "countSR.txt", have 3 columns, ----- column 1 values == column 1 values of file-1 but it repeates .
file-2 : column 1 has its correspondance reference with file-2 column 2
-----------------------
file-1 -- total values are upto 101 (column-1), its just a sample.
0 44 316 7.18182
1 46 372 8.08696
2 47 570 12.1277
3 47 626 13.3191
4 50 1335 26.7
5 41 633 15.439
6 50 1094 21.88
7 45 602 13.3778
8 48 1066 22.2083
9 42 581 13.8333
.
.
.
101 45 303 6.73333
-----------------
file-2, its is just a sample there are 5856 records correponds to column 2. column 2 has unique value, no repeatition.
98 2621 2
44 2622 14
2 2623 19
56 2624 9
95 2625 9
68 2627 8
.
.
.
81 3943 26
56 2163 14
100 2164 37
100 3945 31
13 2165 14
89 3946 35
68 2166 8
37 3947 26
35 3948 20
43 2168 1
87 3949 26
0 2620 11
.........
I need the output as like for every record for file-2 by extracting corresponding values from file-1.
98 2621 2 itsValue
2 2623 19 12.1277
.
.
.
2 1020 20 12.1277
.
.
..........
in file-2 as 1st column values repeats e.g. 2 repeats but its correponding value in file-1 remains the same. So i want to put as I display it above.
Thanks for understanding.
I have tried hard, searching on google, on this forum as well, how getline, FILENAME etc works in awk, using arrays, but fail to come to result.
Thanks in advance for your help.