find

Mass file conversion using find and exec

convert mp3 to opus The short solution find ./ -type f -name '*.mp3' -exec sh -c 'ffmpeg -i "{}" -f wav - | opusenc --music - "{}.opus"' \; The full journey to the solution The first trick was just to use ffmpeg to convert to .wav, and then to take that .wav output and feed it to opusenc1 ffmpeg -i input.mp3 -f wav - | opusenc –bitrate 256 - output.opus

grep one result per file

I use find-grep daily to find a “today in previous journals” (which is one of the only true services Facebook provides, for those who don’t value their privacy). Those entries then go into each day of my daily journal. The trouble is, after you do this for a few years, a big chunk of your daily matches are those same matches from yester-year. I organize my journals by year, so really I just want the first entry that matches a day for each year, and I don’t need the sub-entries.