Who rated this post

cancel
Showing results for 
Search instead for 
Did you mean: 
Bob_Zimmerman
Authority
Authority

I personally use this:

jumbo=$(cpinfo -y fw1 2>/dev/null | grep JUMBO_HF_MAIN | awk '{print $NF}');echo "${jumbo:-0}"

The ${jumbo:-0} part at the end uses variable expansion to replace an empty variable (meaning no jumbo) with 0 so you always get a value.

 

@George_Ellis The "This is Check Point CPinfo Build ..." line is printed to STDERR. Adding 2>/dev/null as Jozko and I did redirects STDERR such that it no longer prints. Any time you get weird output like that which you can't seem to filter away with grep, tail, head, and other common tools, it's probably being written to STDERR.

You can also use 2>&1 to redirect STDERR into STDOUT, at which point the text can be filtered like everything else.

(1)
Who rated this post