<?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: scripting user list in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189932#M680141</link>
    <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;The grep statement is not picking up numbers in the id.&lt;BR /&gt;&lt;BR /&gt; echo ${USERID} | grep -q -E '^[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;Changes to...&lt;BR /&gt; echo ${USERID} | grep -q -E '^[a-zA-Z0-9]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;Untested.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Wed, 29 Jul 2009 13:11:17 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2009-07-29T13:11:17Z</dc:date>
    <item>
      <title>scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189920#M680129</link>
      <description>Here is what i trying to do. First, i am trying to generate a userlist file (where i want to (logins -u) and capture only the id's which are names (we have most id's which are in the format of (2 alphabets and 4 numbers) (ex, jk4567) and we want to exclude those from the userlist file, so that we have the other id's. once the userlist file is generated, then we want to read that file and run a  command &lt;SOME-COMMAND&gt; $USERID so that it modifies the attributes for each id (which are NOT in jk4567) format. Could someone help with this Please?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Mike&lt;/SOME-COMMAND&gt;</description>
      <pubDate>Tue, 28 Jul 2009 16:02:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189920#M680129</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-28T16:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189921#M680130</link>
      <description>Just use grep:&lt;BR /&gt;grep -v '^[a-zA-Z]\{2\}[0-9]\{4\}' user-list</description>
      <pubDate>Tue, 28 Jul 2009 16:11:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189921#M680130</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-28T16:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189922#M680131</link>
      <description>Hi Mike:&lt;BR /&gt;&lt;BR /&gt;One way to generate your file of ids is this way:&lt;BR /&gt;&lt;BR /&gt;# perl -e 'open($fh,"-|","logins -u") or die;while (&amp;lt;$fh&amp;gt;) {@F=split;print unless $F[0]=~m{\d+}}' &amp;gt; /var/tmp/logins&lt;BR /&gt;&lt;BR /&gt;Then you can do:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read USERID X&lt;BR /&gt;do&lt;BR /&gt;echo ${USERID}&lt;BR /&gt;done &amp;lt; /var/tmp/logins&lt;BR /&gt;&lt;BR /&gt;You could imbed the Perl snippet in your shell script too.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Jul 2009 16:13:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189922#M680131</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-28T16:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189923#M680132</link>
      <description>JRF:&lt;BR /&gt;&lt;BR /&gt;How would put all this in the same shell? Also is there a way the whole thing could be done via a shell script alone?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Tue, 28 Jul 2009 16:32:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189923#M680132</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-28T16:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189924#M680133</link>
      <description>&amp;gt;is there a way the whole thing could be done via a shell script alone?&lt;BR /&gt;&lt;BR /&gt;You don't want to use my grep or JRF's perl solution?&lt;BR /&gt;&lt;BR /&gt;You can also use a real shell's pattern matching:&lt;BR /&gt;if [[ name != [a-zA-Z][a-zA-Z][0-9][0-9][0-9][0-9] ]]; then</description>
      <pubDate>Tue, 28 Jul 2009 16:37:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189924#M680133</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-28T16:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189925#M680134</link>
      <description>Oops, that should have been:&lt;BR /&gt;if [[ "$name" != [a-zA-Z][a-zA-Z][0-9][0-9][0-9][0-9] ]]; then</description>
      <pubDate>Tue, 28 Jul 2009 16:38:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189925#M680134</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-28T16:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189926#M680135</link>
      <description>&lt;!--!*#--&gt;Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; How would put all this in the same shell? Also is there a way the whole thing could be done via a shell script alone?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;set -u&lt;BR /&gt;MYFILE=/var/tmp/mylogins&lt;BR /&gt;trap 'rm ${MYFILE}' EXIT&lt;BR /&gt;perl -e 'open($fh,"-|","logins -u") or die;&lt;BR /&gt;    while (&amp;lt;$fh&amp;gt;) {@F=split;print unless $F[0]=~m{\d+}}' &amp;gt; ${MYFILE}&lt;BR /&gt;while read USERID X&lt;BR /&gt;do&lt;BR /&gt;    echo ${USERID}&lt;BR /&gt;done &amp;lt; ${MYFILE}&lt;BR /&gt;&lt;BR /&gt;...in pure Perl, I might do:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my @F;&lt;BR /&gt;my $file = '/var/tmp/mylogins';&lt;BR /&gt;open(my $fh, "-|", "logins -u") or die "Can't open $file:$!\n";&lt;BR /&gt;while (&amp;lt;$fh&amp;gt;) {&lt;BR /&gt;    @F=split;&lt;BR /&gt;    system( "echo", $F[0] ) unless $F[0]=~m{\d+};&lt;BR /&gt;}&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Jul 2009 16:48:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189926#M680135</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-28T16:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189927#M680136</link>
      <description>&lt;!--!*#--&gt;Hi Mike:&lt;BR /&gt;&lt;BR /&gt;Here's a pure shell variation along the lines that Dennis began:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&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; echo ${USERID}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jul 2009 16:59:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189927#M680136</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-28T16:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189928#M680137</link>
      <description>JRF:&lt;BR /&gt;&lt;BR /&gt;One more question. in the script above i see 2 echo statements, i plug in the actual command instead of the second echo statement- correct?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Mike.</description>
      <pubDate>Tue, 28 Jul 2009 20:00:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189928#M680137</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-28T20:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189929#M680138</link>
      <description>Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; One more question. in the script above i see 2 echo statements, i plug in the actual command instead of the second echo statement- correct?&lt;BR /&gt;&lt;BR /&gt;Yes.&lt;BR /&gt;&lt;BR /&gt;Given:&lt;BR /&gt;&lt;BR /&gt;# echo ${USERID} | grep -q -E '^[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;...we are feeding the ${USERID} value to 'grep' with the first 'echo'.  If the return value from 'grep' is zero, there was a match and the second statement (another 'echo')is run.  Hence, this is the one where you want to substitute the real command.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jul 2009 20:34:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189929#M680138</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-28T20:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189930#M680139</link>
      <description>JRF:&lt;BR /&gt;&lt;BR /&gt;GM,&lt;BR /&gt;&lt;BR /&gt;The script worked like a charm for all ID's except one id..the id name was dba10gaf, not sure why the script( shell version above) did not work for this ID. &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Wed, 29 Jul 2009 13:03:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189930#M680139</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-29T13:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189931#M680140</link>
      <description>Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The script worked like a charm for all ID's except one id..the id name was dba10gaf, not sure why the script( shell version above) did not work for this ID.&lt;BR /&gt;&lt;BR /&gt;If you dropped the caret (beginning-of-line) anchor, you would see this behavior:&lt;BR /&gt;&lt;BR /&gt;# USERID=dba10gaf&lt;BR /&gt;# echo ${USERID}|grep -q -E '^[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;#&lt;BR /&gt;# echo ${USERID}|grep -q -E '[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;dba10gaf&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Jul 2009 13:09:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189931#M680140</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-29T13:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189932#M680141</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;The grep statement is not picking up numbers in the id.&lt;BR /&gt;&lt;BR /&gt; echo ${USERID} | grep -q -E '^[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;Changes to...&lt;BR /&gt; echo ${USERID} | grep -q -E '^[a-zA-Z0-9]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;Untested.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 29 Jul 2009 13:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189932#M680141</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-07-29T13:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189933#M680142</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; SEP: The grep statement is not picking up numbers in the id.&lt;BR /&gt;&lt;BR /&gt;SEP, _READ_ the initial OP request again.  Mike wants to EXCLUDE accounts like 'jk4567'.&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jul 2009 13:17:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189933#M680142</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-29T13:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189934#M680143</link>
      <description>so JRF,&lt;BR /&gt;&lt;BR /&gt;do you recommenend to use..&lt;BR /&gt;&lt;BR /&gt;echo ${USERID}|grep -q -E '[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;MIke</description>
      <pubDate>Wed, 29 Jul 2009 14:06:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189934#M680143</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-29T14:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189935#M680144</link>
      <description>Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; do you recommenend to use..&lt;BR /&gt;&lt;BR /&gt;&amp;gt; echo ${USERID}|grep -q -E '[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;No, while this will eliminate accounts like 'jk4567' it will not eliminate accounts like 'jk45lm'.&lt;BR /&gt;&lt;BR /&gt;# echo ${USERID} | grep -q -E '^[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;...skips both the aforementioned accounts.  Isn't that what you want?&lt;BR /&gt;&lt;BR /&gt;If so, notice the caret (^) to anchor the match to the beginning of the string, together with the dollar-sign ($) to anchor to the end of the string.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Jul 2009 14:15:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189935#M680144</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-29T14:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189936#M680145</link>
      <description>JRF&lt;BR /&gt;&lt;BR /&gt;You are correct about excluding jk4567. only these needs to be excluded.(2numbers4letters exact(like 2 numbers first, followed by four letters- total 6) but i still need id's like jk45lm or longer id's (than 6)dba10gaf etc. Thanks JRF, once again&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Wed, 29 Jul 2009 14:30:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189936#M680145</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-29T14:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189937#M680146</link>
      <description>Hi Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; You are correct about excluding jk4567. only these needs to be excluded.(2numbers4letters exact(like 2 numbers first, followed by four letters- total 6) but i still need id's like jk45lm or longer id's (than 6)dba10gaf etc. &lt;BR /&gt;&lt;BR /&gt;See if this meets your needs:&lt;BR /&gt;&lt;BR /&gt;# echo ${USERID} | grep -q -E '^[a-zA-Z]+[0-9]+[a-zA-Z]+$' &amp;amp;&amp;amp; echo ${USERID}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Jul 2009 14:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189937#M680146</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-29T14:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189938#M680147</link>
      <description>JRF&lt;BR /&gt;&lt;BR /&gt;THANKS, it works&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Wed, 29 Jul 2009 17:46:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189938#M680147</guid>
      <dc:creator>MSwift</dc:creator>
      <dc:date>2009-07-29T17:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: scripting user list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189939#M680148</link>
      <description>&amp;gt;(2numbers4letters exact (like 2 numbers first, followed by four letters- total 6)&lt;BR /&gt;&lt;BR /&gt;If you wanted exactly this, you could have used my regexp.</description>
      <pubDate>Wed, 29 Jul 2009 20:06:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-user-list/m-p/5189939#M680148</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-29T20:06:51Z</dc:date>
    </item>
  </channel>
</rss>

