starting form the top of the file I need 1. to get the the value in the 3rd column (c1 d1) 2. search in a second file (file_B.txt, not tab delimited and quite messy) all the matches for it. 3. when a match is found, I would like to append to the current value (c1 d1), the value of 4th column (d1) in file_A.txt, separated by a space. 4. go back to the first file (file_A.txt), get the the value in the 3rd column in the second row (c2 d2) and do another round of search and insert the value of d2 in the second file (file_B.txt).