I use command of find, for example:
find . -name "*.log" -exec grep "running" {} \;
why the command of find need {} , a blank and \?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is because of the
-execparameter: the{}is a placeholder for the file that will be passed to the command.the semicolon (
;) tellsfindthat the-execargument list is over, but since;is also a shell operator, you need to escape it so that it reachesfind:\;-execworks like this: for every file that is found, the first argument after-exec(the command) is executed and all parameters up until the;are passed as arguments to the command. The{}is then replaced by the current filename that is found byfind.