<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866475#M97370</link>
    <description>Hi, I've created a script that put PID's in a variable,&lt;BR /&gt;(PC='ps -fu petra | grep process | cut -c 14-20') now I want to match this output whit the PPID of the process, so that if the PPID is a specific number then do something.&lt;BR /&gt;&lt;BR /&gt;Any suggestions on how to...&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;Petra&lt;BR /&gt;</description>
    <pubDate>Wed, 18 Dec 2002 09:28:28 GMT</pubDate>
    <dc:creator>Petra Sandberg</dc:creator>
    <dc:date>2002-12-18T09:28:28Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866475#M97370</link>
      <description>Hi, I've created a script that put PID's in a variable,&lt;BR /&gt;(PC='ps -fu petra | grep process | cut -c 14-20') now I want to match this output whit the PPID of the process, so that if the PPID is a specific number then do something.&lt;BR /&gt;&lt;BR /&gt;Any suggestions on how to...&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;Petra&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Dec 2002 09:28:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866475#M97370</guid>
      <dc:creator>Petra Sandberg</dc:creator>
      <dc:date>2002-12-18T09:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866476#M97371</link>
      <description>Once you have your pid in $PC then;&lt;BR /&gt;&lt;BR /&gt;ps -fp $PC | awk '{print $3}' | grep -v PPID&lt;BR /&gt;&lt;BR /&gt;returns the PPID of pid $PC&lt;BR /&gt;or you enclose the whole thing above into another variable;&lt;BR /&gt;PPID=$(ps -fp $PC | awk .....)&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Dec 2002 09:38:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866476#M97371</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-12-18T09:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866477#M97372</link>
      <description>You should use awk to pull out the value you want as cut can give wrong values in the way you are using it.&lt;BR /&gt;&lt;BR /&gt;ie on my system&lt;BR /&gt; ps -fu root | grep opcmona  | cut -c 14-20&lt;BR /&gt;Give output of.&lt;BR /&gt;2 10702&lt;BR /&gt;&lt;BR /&gt;Where the value of 2 is actually the last digit of the PID and the other numbers are the PPID you are after.&lt;BR /&gt;&lt;BR /&gt;You should use:&lt;BR /&gt;&lt;BR /&gt;PID=`ps -fu petra | grep process | awk '{ print $2 }'`&lt;BR /&gt;PPID=`ps -fu petra | grep process | awk '{ print $3 }'`&lt;BR /&gt;&lt;BR /&gt;For an individual process this shoould work perfectly to give you both values you require.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Robert Thorneycroft</description>
      <pubDate>Wed, 18 Dec 2002 09:43:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2866477#M97372</guid>
      <dc:creator>Robert Thorneycroft</dc:creator>
      <dc:date>2002-12-18T09:43:52Z</dc:date>
    </item>
  </channel>
</rss>

