I can test whether a string is in a text file with python like the following:

```
if(pdfname in open(filename).read()):
   //do something

```

But how I can I verify it? I want the matching line show up. Thanks.