One of the reasons that I like -exec is that it makes the find command complete in it's own right.
Also, using the syntax find -name "*.java" -exec grep Main {} \+ is equivalent to xargs in terms of performance. Also it's shorter to type as compared to find -name "*.java" -print0 | xargs -0 grep "Main"
Been using UNIX since the late 80s; Linux since the mid-90s; virtualization since the early 2000s and spent the past few years working in the cloud space.
Location
Alexandria, VA, USA
Education
B.S. Psychology from Pennsylvania State University
I'm an old guy. Even in the early 2000s (nearly 10 years into my career), using find with its -exec flag — rather than piping things through xargs — was a great way to bring a system to its knees. Between the slowness of storage and blowing out the process-table space on the much lower memory systems, at the time, you kind of habituated to shuddering at just the thought of someone using -exec. Painful memories die hard, even when you know the apparent cost barely registers, any more.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
One of the reasons that I like
-exec
is that it makes thefind
command complete in it's own right.Also, using the syntax
find -name "*.java" -exec grep Main {} \+
is equivalent to xargs in terms of performance. Also it's shorter to type as compared tofind -name "*.java" -print0 | xargs -0 grep "Main"
I'm an old guy. Even in the early 2000s (nearly 10 years into my career), using
find
with its-exec
flag — rather than piping things throughxargs
— was a great way to bring a system to its knees. Between the slowness of storage and blowing out the process-table space on the much lower memory systems, at the time, you kind of habituated to shuddering at just the thought of someone using-exec
. Painful memories die hard, even when you know the apparent cost barely registers, any more.