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!


#!/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


1 comment:

simashree said...

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

Remove ugly bash (shell) directory highlight colors

Tired of green over blue colors in default Ubuntu shell for directories ? Just type this from your shell console to update your bash profi...