Need advice performing a search
William Park
parkw at better.net
Tue Apr 25 16:50:50 EDT 2000
On Tue, Apr 25, 2000 at 07:58:38PM +0000, Kia Arab wrote:
>
> I am trying to search a file for two strings. If *either* string is
> found, I need the line in which the string was found to be returned (or
> somehow extract the line). It should keep searching and keep returning
> the lines where it finds either string, until the end of file is
> reached.
>
> Any suggestions?
On Unix, 'grep' is what you want. But, I guess you can read line by
line, and test for the 2 strings.
--William
More information about the Python-list
mailing list