1

I get the version of IHS and JAVA by running the script

/ihs_home/HTTPServer/bin/versionInfo.sh

It prints different outputs for different version of IBM HTTP Server products.

Sample extract from the output is below:

.....
Installed Product
--------------------------------------------------------------------------------
Name            IBM SDK, Java Technology Edition, Version 8
Version         8.0.3.0
ID              JAVA8
Build Level     pxa6480sr3ifix-20160615_01
Build Date      06/15/16
Architecture    x86-64 (64 bit)

Installed Product
--------------------------------------------------------------------------------
Name                  IBM HTTP Server for WebSphere Application Server
Version               9.0.5.3
ID                    IHS
Build Level           f5032008.04
Build Date            2/26/20
Package               com.ibm.websphere.IHS.v90_9.0.5003.20200226_0941
Architecture          x86-64 (64 bit)
Installed Features    Core runtime

--------------------------------------------------------------------------------
.....

In the above output, the JDK version is displayed before the WEBSPHERE(IHS) version.

Unfortunately, with different versions of this IBM product, the output may change and it may display the JDK version after the WEBSPHERE(IHS) version.

Thus,

/ihs_home/HTTPServer/bin/versionInfo.sh | grep -v Directory | grep -v reporter |  grep -i version
Output:
Version     8.0.3.0
Version     9.0.5.3

However, with this I cannot determine in the first Version is of WEBSPHERE(IHS) or of JDK.

I need to check if the line prior to the version contains WebSphere then the Version entry below is of websphere(ihs) else it is JDK Version

--------------------------------------------------------------------------------
Name                  IBM HTTP Server for WebSphere Application Server
Version               9.0.5.3

How can I get the know the websphere and JDK version for sure using versionInfo.sh script.

Can someone please suggest?

1
  • grep -A 1 WebSphere | tail -n 1? Something like that? repeat for JDK
    – Panki
    Jul 20, 2020 at 14:59

1 Answer 1

1

Your question isn't clear but whenever you have tag/name-to-value pairs in your input as you do I find it's best to first create an array of those pairings (tag2val[] below) and then you can test and/or print whatever you like, however you like in whatever order you like, e.g.:

$ cat file | awk -v OFS='\t' '
    { tag=val=$0; sub(/[[:space:]].*/,"",tag); sub(/[^[:space:]]*[[:space:]]+/,"",val); tag2val[tag]=val }
    tag == "Version" { print val, tag2val["Name"] }
' file
8.0.3.0 IBM SDK, Java Technology Edition, Version 8
9.0.5.3 IBM HTTP Server for WebSphere Application Server

.

$ cat file | awk -v OFS='\t' '
    { tag=val=$0; sub(/[[:space:]].*/,"",tag); sub(/[^[:space:]]*[[:space:]]+/,"",val); tag2val[tag]=val }
    tag == "Version" { print val, (tag2val["Name"] ~ /WebSphere/ ? "WebSphere" : "JDK") }
' file
8.0.3.0 JDK
9.0.5.3 WebSphere

The above was run using cat file instead of /ihs_home/HTTPServer/bin/versionInfo.sh which I don't have on my system and using what you provided in your question as the input:

$ cat file
.....
Installed Product
--------------------------------------------------------------------------------
Name            IBM SDK, Java Technology Edition, Version 8
Version         8.0.3.0
ID              JAVA8
Build Level     pxa6480sr3ifix-20160615_01
Build Date      06/15/16
Architecture    x86-64 (64 bit)

Installed Product
--------------------------------------------------------------------------------
Name                  IBM HTTP Server for WebSphere Application Server
Version               9.0.5.3
ID                    IHS
Build Level           f5032008.04
Build Date            2/26/20
Package               com.ibm.websphere.IHS.v90_9.0.5003.20200226_0941
Architecture          x86-64 (64 bit)
Installed Features    Core runtime

--------------------------------------------------------------------------------
.....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.