How do I use a pipe in the exec parameter for a find command?

前端 未结 6 2041
孤街浪徒
孤街浪徒 2020-12-13 01:44

I\'m trying to construct a find command to process a bunch of files in a directory using two different executables. Unfortunately, -exec on find doesn\'t allow

6条回答
  •  情歌与酒
    2020-12-13 02:08

    Try this

    find /path/to/jpgs -type f -exec sh -c 'jhead -v {} | grep 123' \; -print
    

    Alternatively you could try to embed your exec statement inside a sh script and then do:

    find -exec some_script {} \;
    

提交回复
热议问题