Getting lines with common emails

hi, so i am new to golang.i want to filter 2 files that i have. first contains list of emails (like 2 Million ish) and second contains email:hash (about 500k ish). i want to compare both files line by line if email 2nd file in in first file than i want to export that email:hash in to 3rd file. E.g


it should output a third file with contents$5435345$5864345

emails that are present in first file.

Hi! Are the two files ordered? (At least the second?) From what I see: no. Right?

Well, there are many ways to do that:

  1. First file2 and create a dictionary with email addr as key.
  2. Pass this dictionary to a routine that read file1 and search the current line in the map. It it is found, write it to third file

You can use goroutines and channels.

hello, they are not ordered.

My solution, try it. Compile and run giving it mails file, mails&hash file and output file paths

1 Like

@Metalymph ty mate. you are a savior.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.