linuxbashffprobegrip

display only lines from output that contains a specified word


I'm looking for a way to get only the lines that contains a specified word, in this case all lines that contains the word Stream from an output

I've tried;

streams=$(ffprobe -i  "movie.mp4"  | grep "Stream")

but that didn't get any results..

or do I need to output it to a file and then try to extract the lines I'm looking for?


Solution

  • @paulsm4 was spot on ... the output goes to STDERR.

    streams=$(ffprobe -i  "movie.mp4"  |& grep "Stream")
    

    Note the &