[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Slickest way to do "joins"/lookups in text files



William Ballard wrote:

> Example:
> I'd like to investigate the most popular RSS readers Debian offers.
> 
> $apt-cache search rss | cut -d' ' -f1 > rss.txt
> $wget http://popcon.debian.org/main/by_vote.gz
> 
> I'd like to "filter" by_vote.gz to just the package names
> in "rss.txt".  In SQL this would be a join.  I'd like it
> to be "fast".  Do I have to do this in SQL?

Grep has a '-f' options that reads patterns from a file, one per line.
Something like this may work, though I'm not sure how "fast" it might be:

zgrep -f rss.txt by_vote.gz

Adam



Reply to: