#!/bin/bash
#
#.Name
# sfind
#.Title
# Find Command for Subversion Workspaces
#.Author
# Don Mitchell (10/2005)
#.What
# Strips out the .svn directories when using the Unix find command.
#
if [ $# -lt 2 ]
then
echo Usage: $(basename $0) [path] [expression...]
fi
path="$1"
shift
find "${path}" ! -wholename '*/.svn/*' -a ! -wholename '*~' \
-a ! -wholename "*/.*.swp" -a "$@"
I put this script in my PATH and then add a few aliases to make it easier to invoke.
alias sf='sfind'
This alias just abbreviates the actual name I gave the shell script. I should have just renamed the shell script. Example: sf . -name "*Foo*.java"
alias sff='sfind . -type f -print0 | xargs -0 grep'
This alias, sff, combines grep with find, grepping for the specified pattern in all files under the current directory. Example: sff SOME_CONSTANT_NAME
alias sfg='sfind . -name "*.java" -print0 | xargs -0 grep'
This alias, does the same thing as my sff alias, but it only greps in Java files and ignores everything else.
- Example: sfg someMethodName
- Example: sfg -l someMethodName # list just the file names containing that mehtod
alias sfn='sfind . -name '
This alias is another quick shortcut, but I rarely use it. For example, sfn "*Dao.java" will list all of the files under the current directory that end in Dao.java.
No comments:
Post a Comment