How can I avoid the "grep: Argument list too long" error?
Solution 1:
You can use the -n
option of xargs
to limit the number of arguments.
find . -name "*" | xargs -n 20 grep 'state-icons'
But a better solution is to use -type f
instead of -name "*"
in order to limit the list to ordinary files, avoiding the error message for each folder.
Note that it does not work for files with whitespace in their names.