我想找到全部爲1920x1080的mp4
文件。如何在find中輸出「for each」?
如果我做
find . -type f -name \*.mp4 -exec ffprobe '{}' \; 2>&1
它會發現所有mp4
文件,並顯示視頻信息。例如。將輸出包含(除其他線路)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './5432223.mp4':
Stream #0:0(und): Video: h264 (High) (avc1/0x31637661), yuv420p, 1920x1080, 1744 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc
我現在的想法是
find . -type f -name \*.mp4 -print0|xargs -0 -n1 echo
for f in $(find . -type f -name \*.mp4); do ffprobe $f 2>&1 | grep 1920x1080;done
,我無法弄清楚如何將if grep -q 1920x1080
並在第一和第二空格中文件名會將輸出混淆。
問題
我怎麼只輸出文件名與路徑,如果輸出匹配1920x1080
?
由於某種原因,如果只適用於沒有空格的文件。我從來沒有見過'sh'被用在'find'中。這開放了什麼? – 2013-05-12 13:45:02
當然,它只適用於沒有空格的文件。如果您需要這個可惡的用例,請添加雙引號! (回答編輯) – 2013-05-12 13:46:36
你怎麼使用一個新的外殼? – 2013-05-12 13:51:53