How to make a grep search on SVN

Want to perform a 'grep' on every files of your subversion repository? Great. Let's have some linux bash fun... Just adapt the following script to your SVN repo structure and enjoy!


#!/bin/bash
 svn ls --username 'alex' --password 'xxx' -r 'HEAD' -R "http://url/svn/repo/" | grep /trunk/ | while read file;
do
   result=`expr match "$file" '.*/$' | cat`
   if [ $result == 0 ]; then  
     result=`svn cat  --username 'alex' --password 'xxx' "http://url/svn/repo/$file" | grep "STRING_TO_FIND" | cat`
     if [ -n "$result" ]; then
       echo "http://url/svn/repo/$file --> $result"
     fi
   fi
done