bglval Frequent Contributor.
Frequent Contributor.
469 views

Split output from ps -ef unix command into fields and perform conditional (if else ) on field 3 ?

 
0 Likes
5 Replies
Dennis Handly Acclaimed Contributor.
Acclaimed Contributor.

Re: Split output from ps -ef unix command into fields and perform conditional (if else ) on field 3

awk(1) can easily handle fields and can do tests.

0 Likes
bglval Frequent Contributor.
Frequent Contributor.

Re: Split output from ps -ef unix command into fields and perform conditional (if else ) on field 3

Hi, thanks for the feedback. How do I use awk in the hpe-oo environment. I know how to use it in the unix environment. But i need to parse the output in HPE-OO ? Thanks
0 Likes
Dennis Handly Acclaimed Contributor.
Acclaimed Contributor.

Re: Split output from ps -ef unix command into fields and perform conditional (if else ) on field 3

> I need to parse the output in MF OO?

 

You could have a pipeline where awk just inserts a delimiter between fields so can be parsed in MF OO easier.

Or have awk do all the work and just pass back simple values.

0 Likes
bglval Frequent Contributor.
Frequent Contributor.

Re: Split output from ps -ef unix command into fields and perform conditional (if else ) on field 3

thanks I can insert delimitters on the unix side , I just need to know how I can parse the values returned using HP-OO environment. Then for example after I can successfully pull out values from HPE-OO environment I want to perform and If else then condition. For example if the process time is has been running for x amount of time I want to do an if else statement and kill the process from running from HPE-OO environment.
0 Likes
Trusted Contributor.. KedarB Trusted Contributor..
Trusted Contributor..

Re: Split output from ps -ef unix command into fields and perform conditional (if else ) on field 3

Hi  bglval

There are multiple way to achieve this.

You can create custom operation or use filter on output or use scriplet section of operation/flow to parse the string/result.

You can write simple javascript scriptlet to perform your parsing and add this to scriplet section of operation so that your output will contain only parsed output. Same method can be used in filter where you can use same code in filter type - scriplet. Also you can use combination of default filter types such as strip/xml parsing/ find&replace filter to achieve required output.

Let me knwo if you have any query.

Regards,

Kedar

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.