<?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 Re: grep command does not show up in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767874#M895897</link>
    <description>I know that (the sar note) doesn't answer the ultimate question about ps|grep, but this thread got me thinking.  Is my understandning about proc-sz correct?&lt;BR /&gt;&lt;BR /&gt;More along those lines, ps|grep seems to become much less dangerous if you use:&lt;BR /&gt;&lt;BR /&gt;UNIX95= /usr/bin/ps -e -ocomm | /usr/bin/grep "^sh$" | /usr/bin/wc -l&lt;BR /&gt;&lt;BR /&gt;using the regex items for begin and end of line.</description>
    <pubDate>Mon, 22 Jul 2002 14:06:33 GMT</pubDate>
    <dc:creator>A. Daniel King_1</dc:creator>
    <dc:date>2002-07-22T14:06:33Z</dc:date>
    <item>
      <title>grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767864#M895885</link>
      <description>Folks,&lt;BR /&gt;&lt;BR /&gt;To find out if a specific application is down (or finished) we count the number of processes (with ps -ef | grep xxx).&lt;BR /&gt;Sometimes the "grep" does not show up.&lt;BR /&gt;cf. the following example :&lt;BR /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;N4000:pmurphya:/lprd1/lprd/work $ ps -fu pmurphya | grep lprdet &lt;BR /&gt;pmurphya 26576 16765  1 11:58:31 pts/tVb   0:00 grep lprdet &lt;BR /&gt;pmurphya 25268     1 70 11:57:10 pts/tcc   0:00 lprdet.exe etbase 0 &lt;BR /&gt;pmurphya 25371     1 63 11:57:12 pts/tcc   0:00 lprdet.exe etbase 1 &lt;BR /&gt;pmurphya 25471     1 64 11:57:14 pts/tcc   0:00 lprdet.exe etbase 2 &lt;BR /&gt;pmurphya 24925 24851 57 11:56:54 pts/tcc   0:00 lprdetcn.exe etctrl &lt;BR /&gt;N4000:pmurphya:/lprd1/lprd/work $ ps -fu pmurphya | grep lprdet &lt;BR /&gt;pmurphya 25268     1 68 11:57:10 pts/tcc   0:00 lprdet.exe etbase 0 &lt;BR /&gt;pmurphya 25371     1 63 11:57:12 pts/tcc   0:00 lprdet.exe etbase 1 &lt;BR /&gt;pmurphya 25471     1 64 11:57:14 pts/tcc   0:00 lprdet.exe etbase 2 &lt;BR /&gt;pmurphya 24925 24851 59 11:56:54 pts/tcc   0:00 lprdetcn.exe etctrl &lt;BR /&gt;N4000:pmurphya:/lprd1/lprd/work $  &lt;BR /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;&lt;BR /&gt;I suggested to the application to reduce count to zero ancd change the command with a pipe to rep -v grep.&lt;BR /&gt;But still would like to know why this is happening ?&lt;BR /&gt;&lt;BR /&gt;thanks for your contribution,&lt;BR /&gt;Jean-Luc&lt;BR /&gt;PS : this is running on N4000 / HPUX11.0</description>
      <pubDate>Fri, 19 Jul 2002 10:13:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767864#M895885</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-07-19T10:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767865#M895886</link>
      <description>hi, &lt;BR /&gt;&lt;BR /&gt;It depends probably about the speed the &lt;BR /&gt;command is executed. A better way to do this&lt;BR /&gt;is : ps -fu pmurphya |grep [l]prdet&lt;BR /&gt;&lt;BR /&gt;The grep command will never show up then. &lt;BR /&gt;&lt;BR /&gt;regards, &lt;BR /&gt;&lt;BR /&gt;Steven</description>
      <pubDate>Fri, 19 Jul 2002 10:24:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767865#M895886</guid>
      <dc:creator>Steven Mertens</dc:creator>
      <dc:date>2002-07-19T10:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767866#M895887</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;to my opinion it is some timing "problem" why sometimes the grep itself shows up (It happened to me before) . When you always want to be sure about the correct number of processes do the grep -v like you said yourself:&lt;BR /&gt;&lt;BR /&gt;ps -ef|grep xxx|grep -v grep&lt;BR /&gt;&lt;BR /&gt;BB</description>
      <pubDate>Fri, 19 Jul 2002 10:30:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767866#M895887</guid>
      <dc:creator>Bart Beeren</dc:creator>
      <dc:date>2002-07-19T10:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767867#M895888</link>
      <description>I've used the &lt;BR /&gt;&lt;BR /&gt;command | grep somestring | grep -v grep&lt;BR /&gt;&lt;BR /&gt;for a long time, but with Steven's example, I probably won't be using the &lt;BR /&gt;&lt;BR /&gt;... | grep -v grep &lt;BR /&gt;&lt;BR /&gt;any longer! Good work Steven!&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Fri, 19 Jul 2002 10:41:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767867#M895888</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-07-19T10:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767868#M895891</link>
      <description>at first I misinterpreted Steven's solution. After the response of Harry I realised what an easy solution it is and that it will work in all cases fine.&lt;BR /&gt;BB</description>
      <pubDate>Fri, 19 Jul 2002 11:05:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767868#M895891</guid>
      <dc:creator>Bart Beeren</dc:creator>
      <dc:date>2002-07-19T11:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767869#M895892</link>
      <description>I like Steven's technique but I'm not sure I could ever re-train my fingers - I've been using the following "psg" script for too long:&lt;BR /&gt;# cat /usr/local/bin/psg&lt;BR /&gt;##########################################################################&lt;BR /&gt;#  psg   -   Process Search&lt;BR /&gt;#            Substitute for "ps -ef|grep" command string.&lt;BR /&gt;##########################################################################&lt;BR /&gt;case $# in&lt;BR /&gt;   0) echo "Error: Argument Expected";&lt;BR /&gt;       exit;&lt;BR /&gt;       ;;&lt;BR /&gt;   1) ps -ef | grep $1 | grep -v "grep"&lt;BR /&gt;       ;;&lt;BR /&gt;   *) echo "Error: Only 1 Argument Allowed";&lt;BR /&gt;       exit;&lt;BR /&gt;       ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 19 Jul 2002 11:14:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767869#M895892</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-07-19T11:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767870#M895893</link>
      <description>Thanks to all , especially Steven. Now I can even spare another process in my command :&lt;BR /&gt;ps -ef | grep -c lprde[t]&lt;BR /&gt;and I get my number of process directly !&lt;BR /&gt;&lt;BR /&gt;JL</description>
      <pubDate>Fri, 19 Jul 2002 11:30:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767870#M895893</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-07-19T11:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767871#M895894</link>
      <description>This has been posted to the forums before, but NEVER use grep with ps when you are looking for a process name! Consider what happens when you are looking for the sh processes--you get "ksh", "csh", "bash", even "washer". Instead, use ps's builtin search capability (which is enabled with XPG4 behavior):&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -fu murphya -C lprdet&lt;BR /&gt;&lt;BR /&gt;ps is smart enough to look at the process table and find an exact string match for lprdet (and it uses the basename, not the full pathname). In the above example, you can search for all sh processes with:&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -fC sh&lt;BR /&gt;&lt;BR /&gt;The UNIX95 variable should only be set temporarily (as in the examples, it is set to null) since exporting UNIX95 will cause several commands and libraries to change behavior. Two additional (and very useful) features are activated with UNIX95: -H (for a list of processes by hierarchy) and -o (which allows for a fully customized appearance.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -efH | more&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -e -o ruser,vsz=Kbytes -o pid,args=Command-Line&lt;BR /&gt;&lt;BR /&gt;In the second example, the real userID is listed, followed by the program's size but with the label changed to Kbytes, then pid and finally the command line, also with a new label.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2002 11:35:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767871#M895894</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2002-07-19T11:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767872#M895895</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The snapshot of the processes running missed the time when your 'grep' was active.  The technique of:&lt;BR /&gt;&lt;BR /&gt;# ps -ef|grep mything|grep -v grep&lt;BR /&gt;&lt;BR /&gt;...is the classic approach.&lt;BR /&gt;&lt;BR /&gt;A better way to find (or count) a particular running process which avoids the need for multiple 'grep's *and* avoids matches for processes you *don't* want is this:&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -fC tar&lt;BR /&gt;&lt;BR /&gt;Note that the UNIX95 variable is set only for the duration of the command line.  'ps' is used to find *only* processes with a basename (here, by example) of "tar".  See the 'ps' man pages for more details.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 19 Jul 2002 11:38:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767872#M895895</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-07-19T11:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767873#M895896</link>
      <description>If I understand correctly, proc-sz (from sar) lists the current and max simultaneous processes:&lt;BR /&gt;&lt;BR /&gt;$sar -v 1&lt;BR /&gt;&lt;BR /&gt;HP-UX fiserv B.11.00 B 9000/800    07/22/02&lt;BR /&gt;&lt;BR /&gt;10:43:55 text-sz  ov  proc-sz  ov  inod-sz  ov  file-sz  ov &lt;BR /&gt;10:43:56   N/A   N/A 459/4020  0    0/5840  0  22431/38890 0&lt;BR /&gt;&lt;BR /&gt;This thread may also prove enlightening:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x5c9703bbece8d5118ff40090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x5c9703bbece8d5118ff40090279cd0f9,00.html&lt;/A&gt;</description>
      <pubDate>Mon, 22 Jul 2002 13:48:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767873#M895896</guid>
      <dc:creator>A. Daniel King_1</dc:creator>
      <dc:date>2002-07-22T13:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: grep command does not show up</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767874#M895897</link>
      <description>I know that (the sar note) doesn't answer the ultimate question about ps|grep, but this thread got me thinking.  Is my understandning about proc-sz correct?&lt;BR /&gt;&lt;BR /&gt;More along those lines, ps|grep seems to become much less dangerous if you use:&lt;BR /&gt;&lt;BR /&gt;UNIX95= /usr/bin/ps -e -ocomm | /usr/bin/grep "^sh$" | /usr/bin/wc -l&lt;BR /&gt;&lt;BR /&gt;using the regex items for begin and end of line.</description>
      <pubDate>Mon, 22 Jul 2002 14:06:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command-does-not-show-up/m-p/2767874#M895897</guid>
      <dc:creator>A. Daniel King_1</dc:creator>
      <dc:date>2002-07-22T14:06:33Z</dc:date>
    </item>
  </channel>
</rss>

