Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. find . -name "*.log" -exec grep "running" {} ;
  2.  
  3. -exec command {} +
  4. This variant of the -exec action runs the specified command on
  5. the selected files, but the command line is built by appending
  6. each selected file name at the end; the total number of invoca‐
  7. tions of the command will be much less than the number of
  8. matched files. The command line is built in much the same way
  9. that xargs builds its command lines. Only one instance of `{}'
  10. is allowed within the command. The command is executed in the
  11. starting directory.
  12.  
  13. -exec command ;
  14.  
  15. Execute command; true if 0 status is returned. All following
  16. arguments to find are taken to be arguments to the command until
  17. an argument consisting of `;' is encountered. The string `{}'
  18. is replaced by the current file name being processed everywhere
  19. it occurs in the arguments to the command, not just in arguments
  20. where it is alone, as in some versions of find. Both of these
  21. constructions might need to be escaped (with a `') or quoted to
  22. protect them from expansion by the shell. See the EXAMPLES sec‐
  23. tion for examples of the use of the -exec option. The specified
  24. command is run once for each matched file. The command is exe‐
  25. cuted in the starting directory. There are unavoidable secu‐
  26. rity problems surrounding use of the -exec action; you should
  27. use the -execdir option instead.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement