Thursday, February 26, 2015

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!

 svn ls --username 'alex' --password 'xxx' -r 'HEAD' -R "http://url/svn/repo/" | grep /trunk/ | while read file;
   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"

1 comment:

simashree said...

Thanks for the great information in your blog Selenium Training in Chennai