I have a script that gives the below output:
WVER0010I: Copyright (c) IBM Corporation 2002, 2012; All rights reserved.
WVER0012I: VersionInfo reporter version 1.15.1.48, dated 2/8/12
--------------------------------------------------------------------------------
IBM WebSphere Product Installation Status Report
--------------------------------------------------------------------------------
Report at date and time September 23, 2020 2:00:11 PM IST
Installation
--------------------------------------------------------------------------------
Product Directory /ihs/IBM/HTTPServer
Version Directory /ihs/IBM/HTTPServer/properties/version
DTD Directory /ihs/IBM/HTTPServer/properties/version/dtd
Log Directory /var/ibm/InstallationManager/logs
Product List
--------------------------------------------------------------------------------
IHS installed
Installed Product
--------------------------------------------------------------------------------
Name IBM HTTP Server for WebSphere Application Server
Version 8.5.5.10
ID IHS
Build Level cf101629.01
Build Date 7/21/16
Package com.ibm.websphere.IHS.v85_8.5.5010.20160721_0036
Architecture x86-64 (64 bit)
Installed Features IBM HTTP Server 64-bit with Java, Version 6
Core runtime
--------------------------------------------------------------------------------
End Installation Status Report
--------------------------------------------------------------------------------
I need to get the version on al flavors of OS like Aix, Linux and Solaris
With the below command I'm getting the desired output:
sh /ihs/IBM/HTTPServer/bin/versionInfo.sh | grep -A 1 WebSphere | tail -n 1 | awk '{print $NF}'
Output: 8.5.5.10
However, when the script output changes slightly like below the same command does not get me the version.
WVER0010I: Copyright (c) IBM Corporation 2002, 2005, 2008; All rights reserved.
WVER0012I: VersionInfo reporter version 1.15.5.1, dated 6/15/11
--------------------------------------------------------------------------------
IBM WebSphere Application Server Product Installation Status Report
--------------------------------------------------------------------------------
Report at date and time September 23, 2020 1:54:10 PM GMT+05:30
Installation
--------------------------------------------------------------------------------
Product Directory /ihs/IBM/HTTPServer
Version Directory /ihs/IBM/HTTPServer/properties/version
DTD Directory /ihs/IBM/HTTPServer/properties/version/dtd
Log Directory /ihs/IBM/HTTPServer/logs
Backup Directory /ihs/IBM/HTTPServer/properties/version/nif/backup
TMP Directory /tmp
Product List
--------------------------------------------------------------------------------
IHS installed
Installed Product
--------------------------------------------------------------------------------
Name IBM HTTP Server
Version 7.0.0.19
ID IHS
Build Level cf191132.09
Build Date 8/13/11
Architecture Intel (32 bit)
--------------------------------------------------------------------------------
End Installation Status Report
--------------------------------------------------------------------------------
Output:
--------------------------------------------------------------------
However, the desired output is:
7.0.0.19
I 'm expecting the same command to give the version number for both the output above.
Note: I guess if we can search for the the line below the line starting with "Name" followed by <whitespaces> and then followed by "IBM HTTP Server" then we will get the version. However, I'm not able to get grep to get me the desired out.
Can you please suggest ?