Let’s find all media files with file or track names containing the word “brain” recursively beginning from the current directory:
find . -type f -exec mediainfo '{}' \+ | tr -s ' ' | tr -s ' ' | sed -e 's/ : /:/' | awk -F: 'function aprt () {printf("%s | %s | %s\n",a["Complete name"], a["Duration"], a["Track name"]);a["Complete name"]="";a["Duration"]="";a["Track name"]="";} {a[$1]=$2} /^General/ {aprt()} END {aprt()}' | fgrep -i brain
Result (file name | duration | track name):
./Jazz Side of the Moon/8 Brain Damage.flac | 6 min 20 s | ./Pink Floyd - TDSOTM - (CP35-3017 Japanese Black Triangle)/8 Brain Damage.flac | 3 min 50 s | Brain Damage ./The Dark Side of The Moon/09.flac | 3 min 51 s | Brain Damage ./Vocomotion - Dark Side of the Moon/08 - Vocomotion - Brain Damage.mp3 | 3 min 53 s | Brain Damage
The “one-liner” above could have been simpler and faster, if there were no spaces in the file names.