The -inv option redirects the inventory to
a file. This option could be used with an option to send decoded
data to STDOUT.
$ wgrib2 file -inv my.inv -text - -no_header -match ':HGT:500 mb:' | JOB
-inv my.inv writes the inventory to my.inv
-text - write the decoded data as a text file to stdout
-no_header no header
JOB is some program that reads the raw data from stdin
The -inv option is very specialized and helps
when you want to imbed wgrib2 within another program. For example,
reading a grib2 record from within perl program is easy.
open(DATA, "wgrib2 file -inv /dev/null -text - -no_header -match ':HGT:500 mb:' |");