'How to get a particular value when using karate.fork?

When we use karate.fork for CLI command and need some information from there to be stored in a variable and using it in the next step.

for EX - karate.fork('java -version')

We need to get only the version data alone.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source