Mic*_*Sim 5 regex svn version-control search
我有多个不同项目的SVN存储库,我想搜索相同的搜索项/正则表达式,但不检查或更新每个项目并手动对每个项目进行搜索.
我想知道是否可以在多个SVN存储库中搜索某些搜索词(或正则表达式)中的文件内容.
这是一个脚本:
if [[ $# < 2 ]]; then
echo "Usage: $0 REGEX TARGET..."
echo "where REGEX is a regular expression for grep"
echo "and TARGET... is a list of SVN repositories"
exit
fi
regex=$1
shift
for svnroot in $@; do
for path in $(svn ls --recursive $svnroot); do
if [[ $path != */ ]]; then
svn cat $svnroot/$path \
| grep --label="$svnroot/$path" --with-filename $regex
fi
done
done
Run Code Online (Sandbox Code Playgroud)