rosgrep: Fast full text search in the ROS tree
These instructions show you how to setup recoll (a full text indexing tool) to index ROS, which allows to grep the entire tree in a fraction of a second.
- Step 1: Install recoll
Karmic contains the proper version:
sudo apt-get install recoll
For earlier distros:
wget http://pr.willowgarage.com/downloads/recoll_1.12.0-0ubuntu1_i386.deb sudo dpkg -i recoll_1.12.0-0ubuntu1_i386.deb
Step 2: configure recoll to index ROS
mkdir -p ~/.recoll cat > ~/.recoll/recoll.conf <<EOF topdirs = `dirname $ROS_ROOT` skippedNames = .svn .git *~ bin CMakeCache.txt CMakeFiles cmake_install.cmake build EOF
Step 3: index ROS tree
recollindex
Optionally, you can add the following line to the /etc/crontab file so that it does the indexing periodically (at 3:30AM in the following example). Replace <user> with your username.
30 3 * * * <user> recollindex > /tmp/recolltrace 2>&1
Step 4: Add the following script to your path:
cat > /tmp/rosgrep <<EOF #!/bin/bash SEARCH_CMD="recoll -t" FILTER_CMD="sed -e s/.*file:\/\/\([^]]*\).*/\1/" \${SEARCH_CMD} \$@ | \${FILTER_CMD} EOF chmod +x /tmp/rosgrep sudo mv /tmp/rosgrep /usr/local/bin/
Step 5: Enjoy fast grepping in ROS
rosgrep <search_term>