i'm learning bash script by doing, and i had to find files which don't contain a certain string and the command i came up with didn't work. I solved the problem in the meantime by using grep -L (stackoverflow.com/questions/1748129/), but i would still want to know, what's wrong with my original command (so i can learn for the future).
the command is:
find path/ -name *.log -print0 | xargs -0 -i sh -c "if [ '1' == $(cat {} | grep -c 'string that should not occur') ]; then echo {}; fi"
and the error
cat: {}: No such file or directory
I also tried without 'sh -c' before, but it didn't work either.
edit: I also tried
find ./path -name *.log -print0 | xargs -0 -i bash -c "if [ '0' == $(cat $0 | grep -c \"ren0 \[RenderJob\] Render time:\") ]; then echo $0; fi" {}
which didn't work because of https://stackoverflow.com/a/1711985/4032670