Well, there is really an infinite number of ways to do this. The attached modification shows a few ways to light an LED if a certain string is present.
The main loop processes each line with 500ms delay such that the progress can be seen as it happens.
It also shows one possible way to format the cluster back into a string that can be written to a file at the end.