On Sun, 24 Mar 2002, Philipp Thomas wrote:
pt> On Sun, 24 Mar 2002 09:17:24 -0500, you wrote:
pt>
pt> >Ok, that is just a simple use of find
pt> >find . -name "*.jpg" ;;
pt>
pt> Nope, that won't keep the shell from expanding the wildcard. Either use single
pt> quotes or a backslash to inhibit wildcard expansion:
pt>
pt> find -name \*.jpg
pt> find -name '*.jpg'
pt>
If you like bash routines, here's one I did a while ago that I stuck in
my .alias file, it's a little overkill, but I find it useful.
function fww {
case "$1" in
-f|--file)
CONTENTS=${2}
SCANDIR=${3-./}/
find ${SCANDIR} -follow -name "*${CONTENTS}*" -exec ls --color=auto {} \;
;;
-h|--help)
echo "Usage: fww [OPTION] PATTERN [PATH]"
echo "Search for PATTERN in/within PATH."
echo "Example: fww "hello.*world" /usr/local"
echo ""
echo " -f, --file locate PATTERN within the name of file(s)"
echo " -h, --help summary of the command-line usage"
echo ""
echo " <PATTERN> search for files that contain PATTERN within"
echo " it's body, multiple words can be supplied"
echo " when they are enclosed within quotes."
echo " <PATH> any filename/path or parts of a filename/path"
echo " can be supplied, rules for PATTERN apply."
echo ""
echo "With no PATH supplied, default will be to current directory."
echo ""
;;
*)
if [ -n "$1" ]; then
CONTENTS=${1}
SCANDIR=${2-.}/
find ${SCANDIR} -follow -type f -exec grep -ln --regexp="${CONTENTS}" {} \;
else
echo "Usage: fww [OPTION] PATTERN [PATH]"
echo "Search for PATTERN in/within PATH."
echo "Try \`fww --help' for more information."
fi
;;
esac
}
pt> Philipp
pt>
pt>
--
S.Toms - smotrs at mindspring.com - www.mindspring.com/~smotrs
SuSE Linux v7.3+ - Kernel 2.4.10-4GB