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: 362
linux
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