To understand recursive grep in xargs

What is the practical difference between the following two commands?

Command A

find . -type f -print0 | xargs -0 grep -r masi       

Command B

find . -type f -print0 | xargs -0 grep masi 

In short, what is the practical benefit of Command A?

Upvotes: 1

Views: 1977

Answers (2)

webclimber
webclimber

Reputation: 2640

I think none The A will try to recurse over file names (as the find is only searching for files) so it will not recurse into anything...

Upvotes: 1

eduffy
eduffy

Reputation: 40224

None .. -r is for recursively searching directories, but the -type f will prevent find from returning directory names.

Upvotes: 3

Related Questions