Results 1 to 3 of 3
Hi people.
I want to create a batch that could find a specific words inside email files, my script need something extra.
This is the main part, but is not ...
- 03-24-2011 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 6
Doubts with find and grep?
Hi people.
I want to create a batch that could find a specific words inside email files, my script need something extra.
This is the main part, but is not giving me what I need:
That output give to me:Code:echo -e "Username: \c" read name if [ -d /home/$name ]; then find /home/$name/Maildir -exec grep -H -w "attachment" {} \; > /home/buffer/$name.txt fi
file path+found string
I need just the /path/filename and forget the found string.
Someone has a idea how to make this possible, do I need to use other commands?
Any tip will be appreciated, thanks!!!
P.S. Centos 5.5.
- 03-24-2011 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
From man grep:
Code:-l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.
- 03-25-2011 #3Just Joined!
- Join Date
- Nov 2009
- Posts
- 6
lomcevak thanks, that was the trick


Reply With Quote