searching files

zweistein zweistein at net.hr
Sun May 12 06:52:11 EDT 2002


Hmmmmmm... Yes, I know this, but I'm currently on Win2k, and do not have
access to grep and/or awk.

Nikola

"William Park" <opengeometry at NOSPAM.yahoo.ca> wrote in message
news:abjqus$j192b$1 at ID-99293.news.dfncis.de...
> zweistein <zweistein at net.hr> wrote:
> > "Chris Liechti" <cliechti at gmx.net> wrote in message
> > news:Xns920BB71141B16cliechtigmxnet at 62.2.16.82...
> >> please provide more information about your data structure and what
exactly
> >> you want to search (names, numbers etc) and you will get more useful
> >> feedback from this group.
> >
> > Well, I am storing every entry in a file. It stores only the name and
the
> > telephone number, and is tab delimited (name surname [TAB] tel.). I am
> > trying to write a function to which a searchstring would be passed which
> > would look into the entire file and show the entry that matches.
> > I would like it to search both names and tel. numbers.
>
> This is no-brainer in Unix, ie.
>     egrep 'surname' file
>     awk '/surname/ {print}' file
> In pure Python, you have to read the file into list, and do string/re
search.
>
> --
> William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
> 8-CPU Cluster, Hosting, NAS, Linux, LaTeX, python, vim, mutt, tin





More information about the Python-list mailing list