bash find xargs grep only single occurence
Posted
by keftebub
on Stack Overflow
See other posts from Stack Overflow
or by keftebub
Published on 2010-05-25T11:46:31Z
Indexed on
2010/05/25
11:51 UTC
Read the original article
Hit count: 222
hi. maybe it's a bit strange - and maybe there are other tools to do this but, well..
i am using the following classic bash command to find all files which contain some string:
find . -type f | xargs grep "something"
i have a great number of files, on multiple depths. first occurence of "something" is enough for me, but find continues searching, and takes a long time to complete the rest of the files. what i would like to do is something like a "feedback" from grep back to find so that find could stop searching for more files. is such a thing possible?
thank you
© Stack Overflow or respective owner