Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

EricBrian

macrumors 6502a
Original poster
Jul 30, 2005
657
8
How to find all *.py files that have the word "404" and "split" in them starting in the "Documents" folder?

Thanks for any help.
 
Code:
for file in `find ~/Documents -type f -name "*.py"`
do 
    if [ -n "`cat $file | grep split`" -a -n "`cat $file | grep 404`" ] 
    then
	echo $file;
    fi
done

Might not be the most efficient, but it ought to work.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.