Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
- The problem statement, all variables and given/known data:
I need to search through the users home directories for keywords, display them. The code listed below will show me the first result but I am not sure how to loop through the results. I am not sure how to make a loop work.
I then need to exclude users from the search if what that script found was phrase that is acceptable. So if the script is ran again the user will not come up again in the search.
I am using a file with a list of the word to search, could I do this with the exclusions as well?
-
Relevant commands, code, scripts, algorithms:
ECHO
GREP -
The attempts at a solution (include all code and scripts):
RESULT=`grep -irf searchwords /home`
FLOC=`echo $RESULT | cut -d : -f 1`
UNAME =`echo $FLOC | cut -d / -f 3`
PHRASE=`echo $RESULT | cut -d : -f 2`
echo "Username: $UNAME, Line with bad word found: $PHRASE, and Path and file name: $FLOC."
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Northeast Wisconsin Techical College, Green Bay, WI - Joe Cicero - UNIX I
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).