Searching a file for multiple strings (PS)

gotbyrd gotbyrd at gmail.com
Tue Feb 3 03:05:37 CET 2009


On Jan 31, 11:39 pm, Shawn Milochik <Sh... at Milochik.com> wrote:
> On Sat, Jan 31, 2009 at 3:00 PM, Tim Chase
>
> <python.l... at tim.thechases.com> wrote:
> >>> I'm fairly new with python and am trying to build a fairly simple
> >>> search script.  Ultimately, I'm wanting to search a directory of files
> >>> for multiple user inputted keywords.  I've already written a script
> >>> that can search for a single string through multiple files, now I just
> >>> need to adapt it to multiple strings.
>
> Not to discourage the use of Python, but it seems that fgrep with the
> -f flag already does exactly what you want. If you're on Windows, you
> can get the Windows version of fgrep here:http://unxutils.sourceforge.net/
>
> Shawn

Shawn,

Thanks for your suggestion, but the office I work in has python 2.4 on
its workstations and we're prohibited from installing outside
software.  Learning to use python was quicker than getting the IT
staff to approve adding new software :)

Jason




More information about the Python-list mailing list