Stop Search param in directories by grep immediately after param match

Posted by yael on Stack Overflow See other posts from Stack Overflow or by yael
Published on 2010-06-17T10:08:27Z Indexed on 2010/06/17 10:13 UTC
Read the original article Hit count: 356

Filed under:

hi friends I use the following command to find under /var some param in my script

grep -R "param" /var/* 2>/dev/null |grep -wq "param"

my problem is that: after grep find the param in file grep continue to search until all searches under /var/* will completed

How to perform stop immediately after grep match the param word

For example when I run the: grep -R "param" /var/* 2>/dev/null |grep -wq "param"

grep find the param after one second.

But grep continue to sears other same param and its take almost 30 seconds

How to stop the grep immediately after param match?

THX

© Stack Overflow or respective owner

Stop Search param in directories by grep immediately after param match

Posted by yael on Super User See other posts from Super User or by yael
Published on 2010-06-17T11:10:06Z Indexed on 2010/06/17 11:13 UTC
Read the original article Hit count: 356

Filed under:

hi friends I use the following command to find under /var some param in my script

grep -R "param" /var/* 2>/dev/null |grep -wq "param"

my problem is that: after grep find the param in file grep continue to search until all searches under /var/* will completed

How to perform stop immediately after grep match the param word

For example when I run the: grep -R "param" /var/* 2>/dev/null |grep -wq "param"

grep find the param after one second.

But grep continue to Search other same param on other files and its take almost 30 seconds

How to stop the grep immediately after param match?

THX

© Super User or respective owner

Related posts about linux