Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
George_Ellis
Advisor

Suppress version name on cpinfo -y?

I am using cpinfo -y to gather information on OS and Take version.  The only issue is that it outputs the version to the screen and then the information.  So I am always getting the cpinfo version published into the output (using Backbox Tech Survey.)

#cpinfo -y SecurePlatform |grep "Take" | awk '{print $2,$3}'

This is Check Point CPinfo Build 914000239 for GAIA
Take: 38




The full return is:

 

#cpinfo -y SecurePlatform

This is Check Point CPinfo Build 914000239 for GAIA
[SecurePlatform]
HOTFIX_ENDER_V17_AUTOUPDATE
HOTFIX_R81_20_JUMBO_HF_MAIN Take: 38

#

 

So in my report, I get this in my spreadsheet cell.

This is Check Point CPinfo Build 9140002A39 for GAIA

Take: 38

 

Any thoughts on how to not show the version?  I have tried a few of the variables and they do not work

 

0 Kudos
11 Replies
the_rock
Legend
Legend

I just tested some options in the lab and cant see anything from -h flag for help that would do this, but will continue to look.

Andy

0 Kudos
JozkoMrkvicka
Authority
Authority

If your goal is to get JHF Jumbo Take number, then use this command:

cpinfo -y all 2>/dev/null|grep HF_MAIN|grep -v _SC|tail -n1|awk '{print $NF}'
Kind regards,
Jozko Mrkvicka
0 Kudos
George_Ellis
Advisor

Thank you.  Almost there.  This is what worked.  I forgot about sending it to /dev/null 

cpinfo -y SecurePlatform 2>/dev/null|tail -n2|awk '{print $2,$3}'

 

the_rock
Legend
Legend

I get this in the lab...

[Expert@R82:0]# cpinfo -y SecurePlatform 2>/dev/null|tail -n2|awk '{print $2,$3}'
hotfixes..

0 Kudos
George_Ellis
Advisor

Maestro Orchestrator, FW, and MDM/MLM all work for me.  R82 thing?

 

0 Kudos
the_rock
Legend
Legend

Hm, does not give any output...

 

[Expert@R82:0]# cpinfo -y all 2>/dev/null|grep HF_MAIN|grep -v _SC|tail -n1|awk '{print $NF}'
[Expert@R82:0]#

0 Kudos
JozkoMrkvicka
Authority
Authority

Because there is no JHF for R82 released yet? 😉

Kind regards,
Jozko Mrkvicka
0 Kudos
the_rock
Legend
Legend

Sorry, of course. I did on R81.20 and gave below, forgot to update, my bad.

Andy

[Expert@CP-GW:0]# cpinfo -y all 2>/dev/null|grep HF_MAIN|grep -v _SC|tail -n1|awk '{print $NF}'
89
[Expert@CP-GW:0]#

0 Kudos
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)
the_rock
Legend
Legend

That works.

0 Kudos
JozkoMrkvicka
Authority
Authority

much better approach !

I can think of executing this command from VS (which in some old JHF shows no hotfixes) and from Domain within MDS.

if VSX : vsenv 0

if MDS : mdsenv

Kind regards,
Jozko Mrkvicka

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events