
February 15th, 2011, 11:47 AM
|
|
Registered User
|
|
Join Date: May 2008
Posts: 22
Time spent in forums: 4 h 5 m 10 sec
Reputation Power: 0
|
|
|
Exec command with grep output
Hello,
I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.
find $directory -type f -mtime +7 | grep ack_reply
Please let me know how can I pass this output to -exec command.
If I am not using grep command my script would be as
find $directory -type f -mtime +7 -exec remove.sh {}\\;;
How can I use -exec with grep and find. Please let me know
|