* Peng Yu <pengyu...@gmail.com> [090829 17:27]: > In linux, I know the command 'locate' which search all the > filenames. But I am wondering if there is a tool that can search > file contents. > > I know that the combination of 'find' and 'grep' can search the > contents, but it is slow. Can somebody let me know if there is a > much faster solution which might rely on an indexing database?
After looking at the various options, I settled on recoll [1] which I'm pretty happy with. Seems fast, it's F/OSS, and it's usable in a cli/terminal environment (in addition to its gui, but I've yet to use the GUI interface). Below is a shell script [2] I wrote that loads the search results into the elinks browser. Then, after appropriately configuring elinks, various search result items can be opened and browsed in different tabs. Regards, John * [1] http://www.recoll.org/ http://www.lesbonscomptes.com/recoll/usermanual/index.html [2] #!/bin/sh # (c)2009 John Magolske, GPLv3 # last edit: 2009/05/02 Sat 22:46 PDT usage=" Facilitates command-line use of the recoll full text search system. USAGE `basename $0` [-s] pattern ... OPTIONS -s enables stem expansion SEE ALSO recoll(1) /usr/share/recoll/doc/usermanual.html " while getopts s option do case "$option" in s) stems="yes";; esac done if [ "$#" -eq 0 ] then echo "$usage" exit 0 fi shift `expr $OPTIND - 1` [ -e /tmp/recoll-search-terms ] && rm /tmp/recoll-search-terms while [ "$#" -ne 0 ] do if [ "$stems" = "yes" ] then if echo "$1" | grep ' ' then echo -n "\"$1\" " >> /tmp/recoll-search-terms else echo -n "$1 " >> /tmp/recoll-search-terms fi shift else if echo "$1" | grep ' ' then echo -n "\"$1\" " >> /tmp/recoll-search-terms else echo -n "$1 " |\ sed y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ \ >> /tmp/recoll-search-terms fi shift fi done recoll -t `cat /tmp/recoll-search-terms` |\ sed -e s/^.*file:/file:/g -e s/[][]//g >| /tmp/recoll-search.txt elinks -no-connect 1 /tmp/recoll-search.txt exit 0 -- John Magolske http://B79.net/contact -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org