trying to use mediainfo | grep with find command
by breadbin from LinuxQuestions.org on (#5F2EC)
Hi there, I am organising my music files and would like to run a command that will go into each sub-directory and output the bit-rate of the mp3. I can output the bit rate ok but not for multiple files in multiple folders. And so I try to use the 'find' command to do this.
I can use
Code:mediainfo * | grep "Bit rate"and it will output the bit rate for all the files in that folder. ideally I would like to run it from the top folder, display the name of the folder, the name of each song and the bitrate.
Code:find -type f -exec mediainfo {} \;will output the mediainfo for each file too but the trouble starts when I try and use grep piped from the output to find the line with "Bit rate". I can't figure the command line out. I have tried wrapping different things in "", I tried adding another -exec for grep, more curly brackets for grep. I'm sure it's dead easy and probably just needs a quote or something to make it work.
This is what I thought should work but it doesn't obviously:)
Code:find -type f -exec mediainfo {} | grep "Bit rate" \;Any help would be appreciated. I could probably do it easier with mpg123 or some other utility which doesn't need the grep part but I would like to use grep and learn something. Thanks.


I can use
Code:mediainfo * | grep "Bit rate"and it will output the bit rate for all the files in that folder. ideally I would like to run it from the top folder, display the name of the folder, the name of each song and the bitrate.
Code:find -type f -exec mediainfo {} \;will output the mediainfo for each file too but the trouble starts when I try and use grep piped from the output to find the line with "Bit rate". I can't figure the command line out. I have tried wrapping different things in "", I tried adding another -exec for grep, more curly brackets for grep. I'm sure it's dead easy and probably just needs a quote or something to make it work.
This is what I thought should work but it doesn't obviously:)
Code:find -type f -exec mediainfo {} | grep "Bit rate" \;Any help would be appreciated. I could probably do it easier with mpg123 or some other utility which doesn't need the grep part but I would like to use grep and learn something. Thanks.