If order of lines in file_B is not important, and if there's no one-to-one line relationship order-wise between file_A and file_B, I'd change your algorithm to this:
- Read file_B and hash each line twice (two hashes): a hash for field_1 and a hash for field_4. Hash values are just 1 (true) for "found it in file_B".
- Read file_C and hash its field_3 the same way.
- Now open file_A and an output file of the desired lines. For each line in file_A, split the line. Now you just compare the split values to each hash and decide whether to write it to the temporary file or not. Write the lines you want to keep to the temporary file.