<?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: awk helppp in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927394#M409356</link>
    <description>I wan to print user root except root with ip 192.120.20.107  ....how to do this??</description>
    <pubDate>Tue, 20 Sep 2005 07:51:32 GMT</pubDate>
    <dc:creator>zap_2</dc:creator>
    <dc:date>2005-09-20T07:51:32Z</dc:date>
    <item>
      <title>awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927383#M409345</link>
      <description>Hi unix gurus,&lt;BR /&gt;If I want to do like this:&lt;BR /&gt;#who -T|awk '$6!=192.120.20.107 and $1=root {print $9}'&lt;BR /&gt;Why this script does not work.Thanks in advance&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Sep 2005 06:54:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927383#M409345</guid>
      <dc:creator>zap_2</dc:creator>
      <dc:date>2005-09-20T06:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927384#M409346</link>
      <description>who -T|awk '{if($6!=192.120.20.107) &amp;amp;&amp;amp; ($1=root)print $9}'</description>
      <pubDate>Tue, 20 Sep 2005 06:57:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927384#M409346</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-09-20T06:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927385#M409347</link>
      <description>Still not work ...</description>
      <pubDate>Tue, 20 Sep 2005 07:05:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927385#M409347</guid>
      <dc:creator>zap_2</dc:creator>
      <dc:date>2005-09-20T07:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927386#M409348</link>
      <description>who -T | awk '($6!="192.120.20.107") &amp;amp;&amp;amp; ($1=="root") {print $9}'&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 20 Sep 2005 07:06:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927386#M409348</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-09-20T07:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927387#M409349</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you mean to print the last field, then 'awk' counts fields one-relative.  The logical 'and' operator is also '&amp;amp;&amp;amp;'.  Did you mean:&lt;BR /&gt;&lt;BR /&gt;# who -T|awk '$8!~/192.120.20.107/ &amp;amp;&amp;amp; $1~/root/ {print $9}'&lt;BR /&gt;&lt;BR /&gt;...or for the last field of the line:&lt;BR /&gt;&lt;BR /&gt;# who -T|awk '$8!~/192.120.20.107/ &amp;amp;&amp;amp; $1~/root/ {print $NF}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Sep 2005 07:10:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927387#M409349</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-09-20T07:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927388#M409350</link>
      <description>Why the above script print all user root even if this user  have ip 192.120.20.107??</description>
      <pubDate>Tue, 20 Sep 2005 07:12:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927388#M409350</guid>
      <dc:creator>zap_2</dc:creator>
      <dc:date>2005-09-20T07:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927389#M409351</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;This works for me:&lt;BR /&gt;&lt;BR /&gt; who -T | awk '/^root/&amp;amp;&amp;amp; !/192.120.20.107 / {print $NF}'&lt;BR /&gt;&lt;BR /&gt;it looks for a line starting with 'root' and not containing a specific IP address anywhere in the line.&lt;BR /&gt;&lt;BR /&gt;please note that the 'dots' in the ip address are in fact regular expression elements for 'any' char. So if the line contained 192X120Y20Z107 then it woudl also be disgarded, but this seems reasonable considering the intended use.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Sep 2005 07:25:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927389#M409351</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-09-20T07:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927390#M409352</link>
      <description>Which script is making problem? Please specify with example line and execution result to get back promptly.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 20 Sep 2005 07:26:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927390#M409352</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-09-20T07:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927391#M409353</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; "Why the above script print all user root even if this user have ip 192.120.20.107??".&lt;BR /&gt;&lt;BR /&gt;The answer is that you negated (with "!") the IPaddress, so you asked for all logins that do NOT match that address but (and) are 'root' users.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Sep 2005 07:33:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927391#M409353</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-09-20T07:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927392#M409354</link>
      <description>&amp;gt;&amp;gt; Why the above script print all user root even if this user have ip 192.120.20.107??&lt;BR /&gt;&lt;BR /&gt;All solutions stated above are negating 192.120.20.107 IP-Address and checking with root user also. Check with example and let us know If you find same problem again.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 20 Sep 2005 07:38:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927392#M409354</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-09-20T07:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927393#M409355</link>
      <description>Try with perl also as,&lt;BR /&gt;&lt;BR /&gt;who -T | perl -ne '$ip=(split)[8] if !/root.*192.120.20.107/;print $ip . "\n";&lt;BR /&gt;&lt;BR /&gt;hth.'</description>
      <pubDate>Tue, 20 Sep 2005 07:41:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927393#M409355</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-09-20T07:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927394#M409356</link>
      <description>I wan to print user root except root with ip 192.120.20.107  ....how to do this??</description>
      <pubDate>Tue, 20 Sep 2005 07:51:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927394#M409356</guid>
      <dc:creator>zap_2</dc:creator>
      <dc:date>2005-09-20T07:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927395#M409357</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; I wan to print user root except root with ip 192.120.20.107 &lt;BR /&gt;&lt;BR /&gt;Then one way is:&lt;BR /&gt;&lt;BR /&gt;# who -T|awk '$1~/^root/ &amp;amp;&amp;amp; $NF!~/192.120.20.107/ {print $0}'&lt;BR /&gt;&lt;BR /&gt;...use print $0 to see the whole line or if you only want the last field, use print $NF.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Sep 2005 07:57:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927395#M409357</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-09-20T07:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927396#M409358</link>
      <description>If I want to print all user root except root for ip 192.120.20.107 and 192.120.20.108.How to  change this script??Thanks</description>
      <pubDate>Tue, 20 Sep 2005 08:05:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927396#M409358</guid>
      <dc:creator>zap_2</dc:creator>
      <dc:date>2005-09-20T08:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927397#M409359</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; If I want to print all user root except root for ip 192.120.20.107 and 192.120.20.108.How to change this script?&lt;BR /&gt;&lt;BR /&gt;# who -T|awk '$1=="root" &amp;amp;&amp;amp; $NF!="192.120.20.107" &amp;amp;&amp;amp; $NF!="192.120.20.108" {print $0}'&lt;BR /&gt;&lt;BR /&gt;...is one way.  I have changed from using regular expressions to string comparisons for exact matching of the fields.  Thus, if you had "root" and "rootuser" this would only match "root" in field #1.  This was one point that Hein had made.&lt;BR /&gt;&lt;BR /&gt;You could also do:&lt;BR /&gt;&lt;BR /&gt;# who -T|awk '$1=="root" &amp;amp;&amp;amp; $NF~/192\.120\.20\.10[78]/ {print $0}'&lt;BR /&gt;&lt;BR /&gt;This last one uses a match of the last field with a regular expression that matches EITHER of the IP address YOU WANT while avoiding the ambiguity of the dot character too.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Sep 2005 08:17:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927397#M409359</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-09-20T08:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk helppp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927398#M409360</link>
      <description>Thanks all gurus .....</description>
      <pubDate>Tue, 20 Sep 2005 22:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-helppp/m-p/4927398#M409360</guid>
      <dc:creator>zap_2</dc:creator>
      <dc:date>2005-09-20T22:35:11Z</dc:date>
    </item>
  </channel>
</rss>

