I tried the below command to search for in all files user /var
sudo find . -type f | xargs sudo grep 202007602 | tee /tmp/202007602.log
Output:
grep: ./www/html/jenkins/workspace/node_modules/xpath/docs/xpath: No such file or directory
grep: methods.md: No such file or directory
grep: ./www/html/jenkins/workspace/Efendibey-Live/node_modules/xpath/docs/function: No such file or directory
grep: resolvers.md: No such file or directory
sudo: unable to execute /bin/grep: Argument list too long
sudo: unable to execute /bin/grep: Argument list too long
Then, I tried a solution from stackoverflow but that too does not work and i get the below error:
sudo find /var -type f -exec sudo grep -l '202007602' {} + | tee /tmp/202007602.log
sudo: unable to execute /bin/grep: Argument list too long
sudo: unable to execute /bin/grep: Argument list too long
....
....
I'm using centos 7.
Can you please suggest ?
sudo
both on thefind
and on thegrep
? It should be enough to havefind
run withsudo
. Drop thesudo
from-exec sudo grep
. Does that solve it?