![]() ![]() The increase in speed is because xargs operates essentially on a batch of the input, the size of which is determined by xargs itself, whereas -exec executes grep on each result from find, one at a time. Now, if we time the use of xargs: time find src -name "*.java" -type f | xargs grep -l interface java files containing the word “interface”: find src -name "*.java" -type f -exec grep -l interface \ tmp files from the /tmp directory: find /tmp -name "*.tmp" -delete Some of the more advanced actions we can use with the find command are: jar files in the target directory: > find target -name "*.jar" -lsĤ316430646 88112 -rw-r-r- 1 mike staff 45110374 Oct 14 15:01 target/app.jarĪnd we can use -printf with a format string to print only the file size and name on each line: > find lib -name "*.jar" -printf '%s %p\n' To demonstrate, let’s use the -ls action to perform a directory listing of all. The -perm option of the find command can help us search files by specific.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |