title: find matching string in 2 large files contains 400 millions lines in PHP
body: <p>i am a basic user in php.</p>
  
  <p>i have 2 large files</p>
  
  <ul>
  <li>file A = 30GB (216 million lines of string)</li>
  <li>file B = 20GB (420 million lines of string)</li>
  </ul>
  
  <p>i want search whatever matching string in file B given by each line in file A
  and either print/save the string which are matched</p>
  
  <p>let say </p>
  
  <p>file A contains:</p>
  
  <pre><code>{"addr":"werwerwer","err":"asjsjka","id":"ssdf83sdfl"}
  {"addr":"acacccaar","err":"xcvxxsd","id":"798asad8sc"}
  {"addr":"asdascacx","err":"lkuuiyh","id":"jkllmlkg8a"}
  {"addr":"jklsdlkfl","err":"hfjyhts","id":"098dejda1s"}
   ...
  </code></pre>
  
  <p>file B contains:</p>
  
  <pre><code>jasdhkjas
  werwerwer
  iusuahsus
  yaiuhasua
  opopasjsl
      ...
  </code></pre>
  
  <p>result will print</p>
  
  <pre><code>werwerwer
  </code></pre>
  
  <p>and continue search till end of file</p>
  
  <p>i hope to solve this in PHP language
  if you think PHP is not efficient/too slow, please provide me a detail coding in other language.</p>
  
  <p>i have searched stackoverflow for the answer but the most i found was mention about 1 million lines, but i thought 400 millions lines is another different way of doing it in terms of time efficiency and coding</p>
  
  <p>prefer PHP-CLI</p>