<?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: Script user list in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195703#M680508</link>
    <description>Thanks again,&lt;BR /&gt;&lt;BR /&gt;Mike</description>
    <pubDate>Sun, 30 Aug 2009 00:09:14 GMT</pubDate>
    <dc:creator>MSwift</dc:creator>
    <dc:date>2009-08-30T00:09:14Z</dc:date>
    <item>
      <title>Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195693#M680498</link>
      <description>Good Morning!&lt;BR /&gt;This is in continuation to&lt;BR /&gt;&lt;A href="http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1359353." target="_blank"&gt;http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1359353.&lt;/A&gt; Thanks to JRF and Dennis for helping me out. However it not capturing all the ID's. Here is what i exactly want. ID's like jk4567 (2 leters and 4 nos) and jk456e (2 letters, 3 nos and one letter). ONLY these 2 combinations need to be filtered and passed to the command, here is the current script..&lt;BR /&gt;&lt;BR /&gt;logins -u | while read USERID X&lt;BR /&gt;do&lt;BR /&gt;    echo ${USERID} | grep -q -E '^[a-zA-Z]+$' &amp;amp;&amp;amp; &lt;SOME_COMMAND&gt; ${USERID}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;&lt;BR /&gt;Mike.&lt;BR /&gt;&lt;BR /&gt;&lt;/SOME_COMMAND&gt;</description>
      <pubDate>Thu, 27 Aug 2009 11:46:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195693#M680498</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-08-27T11:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195694#M680499</link>
      <description>Hi Mike:&lt;BR /&gt;&lt;BR /&gt;For the 'grep' substitute:&lt;BR /&gt;&lt;BR /&gt;grep -q -E '^[a-zA-Z]{2}[0-9]{3}[a-zA-Z0-9]$'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 27 Aug 2009 12:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195694#M680499</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-27T12:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195695#M680500</link>
      <description>Just fwiw,&lt;BR /&gt;&lt;BR /&gt;Please consider doing the filter before the read.&lt;BR /&gt;&lt;BR /&gt;logins -u | grep -E "^[... " | while ..&lt;BR /&gt;&lt;BR /&gt;It is not important here, assuming a low volume or rows (hundreds or thousands).&lt;BR /&gt;&lt;BR /&gt;But for an application selecting thousands amongst millions of rows this order will avoid forking a grep process for every single row. That may be important for some usages, and just feels better for all.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Aug 2009 12:24:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195695#M680500</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-08-27T12:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195696#M680501</link>
      <description>JRF&lt;BR /&gt;&lt;BR /&gt;Thanks, gave 7 points to keep this going (worth 100 :)). i found another grep, your comments please&lt;BR /&gt;&lt;BR /&gt;grep  ^[a-z][a-z][0-9][0-9][0-9][0-9,a-z]: /etc/passwd|cut -d: -f1&lt;BR /&gt;&lt;BR /&gt;One more question JRF, now what if i want to EXCLUDE jk4567 and jk456e, meaning i want to run the some_command on all id's except the type jk4567 and jk456e? (only these type , exactly 6 characters in this combination only)&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Thu, 27 Aug 2009 12:31:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195696#M680501</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-08-27T12:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195697#M680502</link>
      <description>&lt;!--!*#--&gt;Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; i found another grep, your comments please&lt;BR /&gt;&lt;BR /&gt;&amp;gt; grep ^[a-z][a-z][0-9][0-9][0-9][0-9,a-z]: /etc/passwd|cut -d: -f1&lt;BR /&gt;&lt;BR /&gt;This looks for entries in '/etc/passwd' that begin (the ^) with two lowercase letters, followed by 3-digits, followed by either a digit or a lowercase letter and a ":".  If that match is satistifed, then the first colon-delimited field is snipped (cut) from the stream.  TMTOWTDI.  I would have used 'awk' to match and print what I wanted in ONE process.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; One more question JRF, now what if i want to EXCLUDE jk4567 and jk456e, meaning i want to run the some_command on all id's except the type jk4567 and jk456e? (only these type , exactly 6 characters in this combination only)&lt;BR /&gt;&lt;BR /&gt;One way to do this is to test for these exact matches and if seen, skip the loop:&lt;BR /&gt;&lt;BR /&gt;logins -u | while read USERID X&lt;BR /&gt;do&lt;BR /&gt;    [ "${USERID}" = "jk4567" ] &amp;amp;&amp;amp; continue&lt;BR /&gt;    [ "${USERID}" = "jk456e" ] &amp;amp;&amp;amp; continue&lt;BR /&gt;    echo ${USERID} | grep -q -E '^[a-zA-Z]{2}[0-9]{3}[a-zA-Z0-9]$' &amp;amp;&amp;amp; &lt;SOME_COMMAND&gt; ${USERID}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/SOME_COMMAND&gt;</description>
      <pubDate>Thu, 27 Aug 2009 12:44:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195697#M680502</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-27T12:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195698#M680503</link>
      <description>JRF-&lt;BR /&gt;&lt;BR /&gt;Thanks (again), I think i presented my question wrongly, what i wanted was, i wanted run the cammonds on all ID's except of the format jk4567 (2 letters, 4 nos) and of the format jk456e (2 letters, 3 nos and one letter). I did not mean the exact ID jk4567 or jk456e, but instead all ID's of this format should be omitted and command should execute on other ID's.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Thu, 27 Aug 2009 12:51:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195698#M680503</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-08-27T12:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195699#M680504</link>
      <description>Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Thanks (again), I think i presented my question wrongly, what i wanted was, i wanted run the cammonds on all ID's except of the format jk4567 (2 letters, 4 nos) and of the format jk456e (2 letters, 3 nos and one letter). I did not mean the exact ID jk4567 or jk456e, but instead all ID's of this format should be omitted and command should execute on other ID's.&lt;BR /&gt;&lt;BR /&gt;OK, then using the techniques and regular expressions I have shown you, you should be able to do a 'continue' statement in the loop when a 'grep' returns a status (return code) indicating a match for that pattern.&lt;BR /&gt;&lt;BR /&gt;You have the tools :-))&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 27 Aug 2009 12:55:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195699#M680504</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-27T12:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195700#M680505</link>
      <description>JRF:&lt;BR /&gt;&lt;BR /&gt;Thanks, you are truly great, i found the solution (but not w/o your help). Thanks again JRF&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Thu, 27 Aug 2009 17:29:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195700#M680505</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-08-27T17:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195701#M680506</link>
      <description>&amp;gt;if I want to EXCLUDE jk4567 and jk456e,&lt;BR /&gt;&lt;BR /&gt;You can use grep's -v, to exclude patterns.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF:  grep ^[a-z][a-z][0-9][0-9][0-9][0-9,a-z]:&lt;BR /&gt;&amp;gt;followed by either a digit or a lowercase letter and a ":".&lt;BR /&gt;&lt;BR /&gt;I also see a comma inside [].  It could just be a typo.  Otherwise it also matches: aa000,:&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Aug 2009 05:21:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195701#M680506</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-08-28T05:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195702#M680507</link>
      <description>Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: I also see a comma inside []. It could just be a typo.&lt;BR /&gt;&lt;BR /&gt;Yes, that is indeed a typo and should be eliminated.  It was actually posted by Mike as a secondary question of how it worked.  I missed that until you saw it :-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Aug 2009 10:39:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195702#M680507</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-28T10:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195703#M680508</link>
      <description>Thanks again,&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Sun, 30 Aug 2009 00:09:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-user-list/m-p/5195703#M680508</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-08-30T00:09:14Z</dc:date>
    </item>
  </channel>
</rss>

