Sobes.tech
Junior — Middle+

Selection of lines containing specified keywords

livecode

Task condition

Given:

  1. A text file keywords.txt, where each keyword is on a separate line (about 1000 lines).
  2. A text file texts.txt, containing about a million lines, each representing a separate phrase.

It is required to write a program that creates a new file including only those lines from texts.txt in which at least one word from keywords.txt appears.

Example input data: keywords.txt:

foo
bar
baz

(then follows an example of what texts.txt looks like and the expected result, but code blocks are left unchanged).