I have a list of duplicate files on my hard disk. I'm having a hard time to check if a file is not on the list. Grepping
grep $1 $2 > /dev/null || echo $1 works. But I can't get it to work in the -exec-Part of the find command.
find 250G_EXT4/ -type f -exec grep "{}" duplicates_sorted.txt \> /dev/null \|\| echo {} \; The messages are
grep: >: Datei oder Verzeichnis nicht gefunden (File or directory not found) grep: ||: Datei oder Verzeichnis nicht gefunden ... grep: echo: Datei oder Verzeichnis nicht gefunden ... Has anybody a clue to get the escape sequence right? Or maybe a different idea?
-exectakes a single command and its arguments; you can't include redirections, which are processed by a shell, not passed to theexecsystem call, or||, which is a shell operator for conditional execution.