<?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 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684814#M794716</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Not for points but for your interest&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com" target="_blank"&gt;www.shelldorado.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;              Steve Steel</description>
    <pubDate>Tue, 06 Dec 2005 04:24:57 GMT</pubDate>
    <dc:creator>Steve Steel</dc:creator>
    <dc:date>2005-12-06T04:24:57Z</dc:date>
    <item>
      <title>scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684808#M794710</link>
      <description>How can I combine &lt;BR /&gt;&lt;BR /&gt;awk -F":" 'print $1' &lt;BR /&gt;&lt;BR /&gt;with &lt;BR /&gt;&lt;BR /&gt;typeset -l&lt;BR /&gt;&lt;BR /&gt;and&lt;BR /&gt;&lt;BR /&gt;cut -c1-6&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When I try to run the following:&lt;BR /&gt;&lt;BR /&gt;while read testuser&lt;BR /&gt;do&lt;BR /&gt;testname = $testuser | awk -F":" '{print $1}' | typeset -l | cut -c-6&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testoutput&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; testfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It gives me the following error:&lt;BR /&gt;&lt;BR /&gt;videv01:/home/root/rav/test# ./testscript.sh&lt;BR /&gt;./testscript.sh[4]: testname:  not found.&lt;BR /&gt;./testscript.sh[4]: testname:  not found.&lt;BR /&gt;videv01:/home/root/rav/test# ./testscript.sh[4]: testname:  not found.&lt;BR /&gt;./testscript.sh[4]: testname:  not found.&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Dec 2005 12:03:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684808#M794710</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-12-05T12:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684809#M794711</link>
      <description>try:&lt;BR /&gt;&lt;BR /&gt;typeset -l testname&lt;BR /&gt;testname=$(echo $testuser | awk -F":" '{print $1}' | cut -c1-6)</description>
      <pubDate>Mon, 05 Dec 2005 12:10:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684809#M794711</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2005-12-05T12:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684810#M794712</link>
      <description>typeset -l testname=$(echo "${testuser}" | awk -F":" '{print $1}' | cut -c-6)&lt;BR /&gt;&lt;BR /&gt;Although you could do a substr() inside awk to get rid of the and do a tolower() as well&lt;BR /&gt;for better efficiency.&lt;BR /&gt;&lt;BR /&gt;testname=$(echo "${testuser}" | awk -F ':' '{print tolower(substr($1,1,6))}')&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Dec 2005 12:11:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684810#M794712</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-12-05T12:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684811#M794713</link>
      <description>Need to use command substitution like:&lt;BR /&gt;&lt;BR /&gt;testname=$($testuser | awk -F":" '{print $1}' | typeset -l | cut -c-6)&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Dec 2005 12:20:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684811#M794713</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-12-05T12:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684812#M794714</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You already have the answer to your question, but, as an aside -- a useful thing sometimes -- you can lowercase or uppercase all or any field by updating it within 'awk':&lt;BR /&gt;&lt;BR /&gt;# echo "UPPER MADE LOWER"|awk '{$0=tolower($0);print $0}'&lt;BR /&gt;&lt;BR /&gt;...changes $0 (the current line) to lowercase.  Then, all subsequent references, including those to individual fields, contain lowercase letters and can be referenced/matched as such.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 05 Dec 2005 13:10:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684812#M794714</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-05T13:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684813#M794715</link>
      <description>Hi,&lt;BR /&gt;you can use only awk to obtain your result:&lt;BR /&gt;&lt;BR /&gt;echo $testuser|awk -F ":" '{print tolower(substr($1,1,6))}'|read testname&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Tue, 06 Dec 2005 04:08:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684813#M794715</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2005-12-06T04:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684814#M794716</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Not for points but for your interest&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com" target="_blank"&gt;www.shelldorado.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;              Steve Steel</description>
      <pubDate>Tue, 06 Dec 2005 04:24:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684814#M794716</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2005-12-06T04:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684815#M794717</link>
      <description>Simply as,&lt;BR /&gt;&lt;BR /&gt;awk -F: '{ print tolower(substr($1,1,6)); }' testfile &amp;gt;&amp;gt; testoutput&lt;BR /&gt;&lt;BR /&gt;instead all your try.&lt;BR /&gt;&lt;BR /&gt;Problem is with,&lt;BR /&gt;testname = $testuser | awk -F":" '{print $1}' | typeset -l | cut -c-6&lt;BR /&gt;&lt;BR /&gt;Change this to,&lt;BR /&gt;&lt;BR /&gt;testname = $(echo $testuser | awk -F":" '{print $1}' | typeset -l | cut -c-6)&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 06 Dec 2005 04:44:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684815#M794717</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-06T04:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684816#M794718</link>
      <description>Guys thanks for your help so far. I did the following: &lt;BR /&gt;&lt;BR /&gt;rm testoutput&lt;BR /&gt;rm testokusers&lt;BR /&gt;rm testnotokusers&lt;BR /&gt;&lt;BR /&gt;while read testuser&lt;BR /&gt;do&lt;BR /&gt;typeset -l testname&lt;BR /&gt;testname=$(echo $testuser | awk -F":" '{print $1}' | cut -c1-6)&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testoutput&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; passgvts&lt;BR /&gt;&lt;BR /&gt;#the above reads passgvts file and extracts the first 6 characters of the first&lt;BR /&gt;field from each line thus creating a testname (in lowercase)&lt;BR /&gt;&lt;BR /&gt;while read testname&lt;BR /&gt;do&lt;BR /&gt;grep $testname vosalist.sorted&lt;BR /&gt;if&lt;BR /&gt;[ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testokusers&lt;BR /&gt;else&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testnotokusers&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; testoutput&lt;BR /&gt;&lt;BR /&gt;#if testname is found in the vosalist then the username is sent to testokusers e&lt;BR /&gt;lse it is sent to testnotokusers&lt;BR /&gt;&lt;BR /&gt;while read fakeuser&lt;BR /&gt;fullfakename=$ {echo $fullfakename | awk -F":" '{print $1}'}&lt;BR /&gt;do&lt;BR /&gt;grep $fakeuser passgvts&lt;BR /&gt;if&lt;BR /&gt;[ $? = o ]&lt;BR /&gt;then&lt;BR /&gt;echo $fullfakename &amp;gt;&amp;gt; queryusers&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; testnotokusers&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The first part is working fine. What I am then trying to do is, for all the entries in testnotokusers I am trying to get the grep for it the passgvts file and send out the full entry in the first (not just first 6 characters) to a file called queryusers. This is the part that is not working. Can anybody advise?</description>
      <pubDate>Wed, 07 Dec 2005 08:41:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684816#M794718</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-12-07T08:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684817#M794719</link>
      <description>Please throw a point toward Steve Steel on my behalf. That's a new site to me. Thanks, Steve.</description>
      <pubDate>Wed, 07 Dec 2005 11:37:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684817#M794719</guid>
      <dc:creator>Andy Torres</dc:creator>
      <dc:date>2005-12-07T11:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684818#M794720</link>
      <description>Ok I changed the script as follows:&lt;BR /&gt;&lt;BR /&gt;rm testoutput&lt;BR /&gt;rm testokusers&lt;BR /&gt;rm testnotokusers&lt;BR /&gt;&lt;BR /&gt;while read testuser&lt;BR /&gt;do&lt;BR /&gt;typeset -l testname&lt;BR /&gt;testname=$(echo $testuser | awk -F":" '{print $1}' | cut -c1-6)&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testoutput&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; passgvts&lt;BR /&gt;&lt;BR /&gt;#the above reads passgvts file and extracts the first 6 characters of the first&lt;BR /&gt;field from each line thus creating a testname (in lowercase)&lt;BR /&gt;&lt;BR /&gt;while read testname&lt;BR /&gt;do&lt;BR /&gt;grep $testname vosalist.sorted&lt;BR /&gt;if&lt;BR /&gt;[ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testokusers&lt;BR /&gt;else&lt;BR /&gt;echo $testname &amp;gt;&amp;gt; testnotokusers&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; testoutput&lt;BR /&gt;&lt;BR /&gt;#if testname is found in the vosalist then the username is sent to testokusers e&lt;BR /&gt;lse it is sent to testnotokusers&lt;BR /&gt;&lt;BR /&gt;#fullfakename=$ {echo $fullfakename | awk -F":" '{print $1}'}&lt;BR /&gt;&lt;BR /&gt;while read fakeuser&lt;BR /&gt;do&lt;BR /&gt;grep $fakeuser passgvts &amp;gt;&amp;gt; queryusers&lt;BR /&gt;done &amp;lt; testnotokusers&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;everything works fine except one thing. In a lot of the cases I have two similar usernames in passgvts file ie:&lt;BR /&gt;&lt;BR /&gt;gillars&lt;BR /&gt;gillarst&lt;BR /&gt;jonesra&lt;BR /&gt;jonesrat&lt;BR /&gt;&lt;BR /&gt;As I am matching the entries in testnotokusers, if for example in testnotokusers I have:&lt;BR /&gt;&lt;BR /&gt;gillar&lt;BR /&gt;gillar&lt;BR /&gt;jonesr&lt;BR /&gt;jonesr&lt;BR /&gt;&lt;BR /&gt;the out put in the file queryusers is double for most entries ie:&lt;BR /&gt;&lt;BR /&gt;gillars&lt;BR /&gt;gillarst&lt;BR /&gt;gillars&lt;BR /&gt;gillarst&lt;BR /&gt;jonesra&lt;BR /&gt;jonesrat&lt;BR /&gt;jonesra&lt;BR /&gt;jonesrat&lt;BR /&gt;&lt;BR /&gt;So I want to modify my script so that it only outputs the result of grep $fakeuser passgvts to queryusers if the entry does not already exist in there. How do I do this please???</description>
      <pubDate>Fri, 09 Dec 2005 05:25:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684818#M794720</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-12-09T05:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684819#M794721</link>
      <description>any advice?</description>
      <pubDate>Fri, 09 Dec 2005 07:44:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684819#M794721</guid>
      <dc:creator>Ravinder Singh Gill</dc:creator>
      <dc:date>2005-12-09T07:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684820#M794722</link>
      <description>&lt;BR /&gt;Hmm, you make my head spin with all those files and tweaks. Seems to me this is not all that hard a problem when using a language like perl, or the shell, if you just remember values as you see them instead of sticking them in a file.&lt;BR /&gt;As others indicate... if you use a tool like awk, just lett it do as many steps as it can in one go (the field select, cut, case-change)&lt;BR /&gt;&lt;BR /&gt;Anyway.. back to the last part, where you want to avoid ouput twice. Here is a practicular example which 'remembers' having seen a value by incrementing an array element in perl (could use awk or shell). Only print if it was zero before the increment.&lt;BR /&gt;This example also reads teh file to be grepped into a memory array, and greps that.&lt;BR /&gt;&lt;BR /&gt;---- test.pl ----&lt;BR /&gt;open (PASS,"&lt;PASSGVTS&gt;&lt;/PASSGVTS&gt;@pass=&lt;PASS&gt;; &lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;chomp;&lt;BR /&gt; if (grep(/^$_$/,@pass)) {&lt;BR /&gt;  print "$_\n" unless $seen{$_}++;&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;------ usage example ----&lt;BR /&gt;&lt;BR /&gt;perl test.pl &amp;lt; testnotokusers &amp;gt; queryusers&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PASS&gt;</description>
      <pubDate>Sat, 10 Dec 2005 14:10:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684820#M794722</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-12-10T14:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684821#M794723</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;just a thought,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;&lt;BR /&gt;while read testuser&lt;BR /&gt;do&lt;BR /&gt;typeset -l testname&lt;BR /&gt;testname=$(echo $testuser | awk -F":" '{print $1}' | cut -c1-6)&lt;BR /&gt;echo $testname&lt;BR /&gt;done &amp;lt; passgvts | sort -u &amp;gt; testoutput&lt;BR /&gt;</description>
      <pubDate>Sat, 10 Dec 2005 17:08:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3684821#M794723</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2005-12-10T17:08:23Z</dc:date>
    </item>
  </channel>
</rss>

