<?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 sed keyword in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786621#M494749</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HI&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the below output&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps -ef | grep ctm&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;cimsrvr-ctm &amp;nbsp;4575 4574 0 Oct 30 ? 473:33 cimservermain --executor-socket 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above ps output is an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to filter the ctm keyword alone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;details=`ps -ef | grep&amp;nbsp;&lt;SPAN&gt;ctm | awk '{print $1}'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;echo $details&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cimsrvr-ctm&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From the above output I need to filter only ctm and I don't want cimsrvr.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to use sed to filter the keyword but I am not able to find the correct sysntax to sed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 20 Sep 2015 10:18:01 GMT</pubDate>
    <dc:creator>krissh89</dc:creator>
    <dc:date>2015-09-20T10:18:01Z</dc:date>
    <item>
      <title>sed keyword</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786621#M494749</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HI&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the below output&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps -ef | grep ctm&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;cimsrvr-ctm &amp;nbsp;4575 4574 0 Oct 30 ? 473:33 cimservermain --executor-socket 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above ps output is an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to filter the ctm keyword alone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;details=`ps -ef | grep&amp;nbsp;&lt;SPAN&gt;ctm | awk '{print $1}'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;echo $details&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cimsrvr-ctm&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From the above output I need to filter only ctm and I don't want cimsrvr.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to use sed to filter the keyword but I am not able to find the correct sysntax to sed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2015 10:18:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786621#M494749</guid>
      <dc:creator>krissh89</dc:creator>
      <dc:date>2015-09-20T10:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: sed keyword</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786632#M494750</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; You don't really need "awk".&amp;nbsp; For example:&lt;BR /&gt;&lt;BR /&gt;mba$ echo "cimsrvr-ctm&amp;nbsp; 4575 4574 0 Oct 30 ? 473:33 cimservermain\&lt;BR /&gt;&amp;nbsp;--executor-socket 4" | sed -e 's/[^-]*-\([^ ]*\).*/\1/'&lt;BR /&gt;ctm&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; This "sed" command looks for any number of non-hyphens followed by a&lt;BR /&gt;hyphen ("[^-]*-"), any number of non-spaces ("[^ ]*"), and any number of&lt;BR /&gt;any characters (".*").&amp;nbsp; For all that, it substitutes ("s/x/y/") the&lt;BR /&gt;non-spaces ("\1", the stuff between "\(" and "\)").&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I need to filter the ctm keyword alone.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; That could mean many things.&amp;nbsp; I removed the stuff up to the first&lt;BR /&gt;hyphen from the first space-separated token.&amp;nbsp; If you want to use "awk"&lt;BR /&gt;to separate the first token, then "sed" can remove everything up through&lt;BR /&gt;the first hyphen:&lt;BR /&gt;&lt;BR /&gt;mba$ echo 'cimsrvr-ctm' | sed -e 's/[^-]*-//'&lt;BR /&gt;ctm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; This "sed" command looks for any number of non-hyphens followed by a&lt;BR /&gt;hyphen ("[^-]*-"), and substitutes nothing for them.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2015 12:54:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786632#M494750</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2015-09-20T12:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: sed keyword</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786642#M494751</link>
      <description>&lt;P&gt;Thanks for the information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I need to get the output only as ctm &amp;nbsp;in first column instead of &lt;SPAN&gt;cimsrvr-ctm&amp;nbsp;&lt;/SPAN&gt;when i run ps -ef | grep ctm &amp;nbsp;so that is the reason I have put awk to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2015 15:20:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786642#M494751</guid>
      <dc:creator>krissh89</dc:creator>
      <dc:date>2015-09-20T15:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: sed keyword</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786653#M494752</link>
      <description>&lt;P&gt;&amp;gt; [...] so that is the reason I have put awk to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Did you look at my first example? &amp;nbsp;Did it work? &amp;nbsp;Did it use "awk"?&lt;BR /&gt;You can use "awk" if you wish, but I claim that it's not needed here.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2015 17:12:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786653#M494752</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2015-09-20T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk filtering</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786659#M494753</link>
      <description>&lt;P&gt;&amp;gt;I need to get the output only as ctm&amp;nbsp; in first column instead of cimsrvr-ctm when I run ps -ef | grep ctm&amp;nbsp; so that is the reason I have put awk to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please explain EXACTLY what you want and not how you think it should be done.&amp;nbsp; Do you want the user that has embedded "ctm" or the user exactly "ctm"?&lt;/P&gt;&lt;P&gt;Do you want the rest of the ps(1) output?&amp;nbsp; ps(1) has its own filtering options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;&amp;nbsp; You don't really need "awk".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And alternate statement is that you don't need sed nor grep if you have awk.&amp;nbsp; :-)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want the list of all users that have "ctm" as the last 3 chars of the name, running processes:&lt;/P&gt;&lt;P&gt;UNIX95=EXTENDED_PS ps -e -ouser= | awk '/ctm/ {l = length($1); print subst($1, l-3)}' | sort -u&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 08:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786659#M494753</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2015-09-21T08:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: sed filtering</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786690#M494754</link>
      <description>&lt;P&gt;I am trying to write a script to start a process if that process is stopped automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my firrst level script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/bin/ksh&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;pdweb status |grep -w no &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/P&gt;&lt;P&gt;if [ $? -eq 0 ];then&lt;/P&gt;&lt;P&gt;FailedComponents=`pdweb status |grep -w no |awk '{print $1}'`&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for i in $FailedComponents; do&lt;/P&gt;&lt;P&gt;/etc/rc.d/init.d/ahpdweb_start.sh start $i&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;else&lt;BR /&gt;echo "All components are up"&lt;BR /&gt;fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------&lt;/P&gt;&lt;P&gt;When I run the&amp;nbsp;&lt;SPAN&gt;FailedComponents=`pdweb status |grep -w no |awk '{print $1}'` ,&amp;nbsp;&lt;EM&gt;&amp;nbsp;I am&amp;nbsp;&lt;/EM&gt; getting the below ouptiut.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;webseald-plaza_portal&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;/P&gt;&lt;P&gt;webseald-webseald&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/P&gt;&lt;P&gt;webseald-webseald1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;webseald-webseald2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but to start the web seal process I need to input only&amp;nbsp;plaza_portal and not&amp;nbsp;webseald-plaza to&amp;nbsp;/etc/rc.d/init.d/ahpdweb_start.sh start $i &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I am trying to ignore all the keyword before "-"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 04:39:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786690#M494754</guid>
      <dc:creator>krissh89</dc:creator>
      <dc:date>2015-09-21T04:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: sed filtering</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786691#M494755</link>
      <description>&lt;P&gt;&amp;gt; So I am trying to ignore all the keyword before "-"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Ok.&amp;nbsp; Again, did you look at my "sed" examples?&amp;nbsp; Did they work?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 04:56:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786691#M494755</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2015-09-21T04:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: awk filtering</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786747#M494756</link>
      <description>&lt;P&gt;&amp;gt;Here is my first level script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming the length of the prefix is always 9:&lt;/P&gt;&lt;P&gt;FailedComponents=$(pdweb status | awk '$2 == "no" || $3 == "no" {print substr($1, 10)}')&lt;/P&gt;&lt;P&gt;if [ "$FailedComponents" != "" ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; for i in $FailedComponents; do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /etc/rc.d/init.d/ahpdweb_start.sh start $i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; done&lt;/P&gt;&lt;P&gt;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; echo "All components are up"&lt;BR /&gt;fi&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 08:06:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6786747#M494756</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2015-09-21T08:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: sed keyword</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6807784#M494757</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&amp;nbsp; You don't really need "awk".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An alternate statement is that you don't need sed nor grep if you have awk.&amp;nbsp; :-)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(some how I never posted this back in Sep 20, found it my autosave drafts.)&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2015 05:29:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-keyword/m-p/6807784#M494757</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2015-10-31T05:29:33Z</dc:date>
    </item>
  </channel>
</rss>

