Returning version of operating system as number

(imported topic written by SystemAdmin)

I want to capture the numeric value of “name of operating system”

For example:

Q: A: Linux Oracle Enterprise Server release 5.7

Q: A: AIX 6.1

Q: A: SunOS 5.9

As you can see it’s always the last/end of line

So what command can I run to return only the version number?

5.7

6.1

5.9

(imported comment written by SystemAdmin)

Figured it out using:

following text of last " " of concatenation " " of name of operating system

Q: name of operating system

A: Linux Oracle Enterprise Server release 5.7

T: 91

Q: following text of last " " of concatenation " " of name of operating system

A: 5.7

T: 302

(imported comment written by SystemAdmin)

Did you try

version of operating system

This should return the numeric portion

(imported comment written by SystemAdmin)

Yes you are correct for AIX and Solaris, but not Linux

Oracle Enterprise Linux (OEL)

Q: version of operating system

A: Server release 5.7

AIX

Q: version of operating system

A: 6.1

(imported comment written by SystemAdmin)

Ah yes. The operator was changed in 9.0 to do what people expected (which was to return the version)