<?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: Help in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266805#M333597</link>
    <description>Denis,&lt;BR /&gt;&lt;BR /&gt;Thanks alot for your help, could you please help me a little bit more. Can you please little more explain working of your script so that I can modify it further?</description>
    <pubDate>Thu, 11 Sep 2008 16:37:50 GMT</pubDate>
    <dc:creator>Waqar Razi</dc:creator>
    <dc:date>2008-09-11T16:37:50Z</dc:date>
    <item>
      <title>Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266798#M333590</link>
      <description>I have 3 passwd files from three servers namely passwd1, passwd2, passwd3. Some users are present only on one server, some are present in two and some of them are present in 3 passwd files. If they are present in more than 1 server, they have the same user name. I want to modify the following script:&lt;BR /&gt;&lt;BR /&gt;sort passwd1 passwd2 passwd3 | awk -F: '&lt;BR /&gt;BEGIN { getline; name = $1; uid = $3 }&lt;BR /&gt;{&lt;BR /&gt;if ($1 == name) {&lt;BR /&gt;   uid = uid " " $3 # concat&lt;BR /&gt;} else {&lt;BR /&gt;   print name, uid  # print last&lt;BR /&gt;   name = $1; uid = $3&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;END { print name, uid } '&lt;BR /&gt;&lt;BR /&gt;It gives output like the following:&lt;BR /&gt;ufeabjp 16128 16128 16128&lt;BR /&gt;ufeabln 16096 16096 16096&lt;BR /&gt;ufeabms 16118 16118 16118&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This script prints username followed by his ids in three servers. I want to add some more information to it like Real name, description and if possible I want to add the time and date when the user logged in last time.&lt;BR /&gt;&lt;BR /&gt;The desired output is:&lt;BR /&gt;&lt;BR /&gt;username userid userid userid Name Desc lastlogin&lt;BR /&gt;&lt;BR /&gt;Can any one help me in modifying the script?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Sep 2008 15:49:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266798#M333590</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2008-09-10T15:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266799#M333591</link>
      <description>What you are asking is ambiguous. How can you add a name/desc if a user appears in all 3 passwd files? Do you know that the real name/desc is the same in all 3 files? Even if it is the same person there could be different spellings. The lastlogin info is not in the password files so where would you get that from using awk and from which of the 3 servers?&lt;BR /&gt;If you are more specific about your requirements, someone might be able to help you.</description>
      <pubDate>Wed, 10 Sep 2008 16:13:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266799#M333591</guid>
      <dc:creator>TTr</dc:creator>
      <dc:date>2008-09-10T16:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266800#M333592</link>
      <description>Hi Wagar:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I want to add the time and date when the user logged in last time.&lt;BR /&gt;&lt;BR /&gt;From which server would you want the last login information, or don't you really want the most *recent* timestamp of all of them?&lt;BR /&gt;&lt;BR /&gt;We offered considerable insight if you revisit your thread here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1263622" target="_blank"&gt;http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1263622&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 10 Sep 2008 16:14:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266800#M333592</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-09-10T16:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266801#M333593</link>
      <description>Name and description from the first passwd file is fine and last login from the first server is fine using last</description>
      <pubDate>Wed, 10 Sep 2008 16:31:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266801#M333593</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2008-09-10T16:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266802#M333594</link>
      <description>if the stems are trusted systems you could get the last successful login time with getprpw. You might be better off seeing if ldap keeps last login info in the db and just implementing it.</description>
      <pubDate>Wed, 10 Sep 2008 16:34:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266802#M333594</guid>
      <dc:creator>Court Campbell</dc:creator>
      <dc:date>2008-09-10T16:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266803#M333595</link>
      <description>Sorry. stems should be systems.</description>
      <pubDate>Wed, 10 Sep 2008 16:34:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266803#M333595</guid>
      <dc:creator>Court Campbell</dc:creator>
      <dc:date>2008-09-10T16:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266804#M333596</link>
      <description>&amp;gt;Real name, description and if possible I want to add the time and date when the user logged in last time.&lt;BR /&gt;&lt;BR /&gt;As JRF mentioned, look at your other thread.&lt;BR /&gt;If you want the name and description, you would need to capture more fields:&lt;BR /&gt;BEGIN { getline; name = $1; uid = $3; rname = $5 }&lt;BR /&gt;...&lt;BR /&gt;print name, uid, rname # print last&lt;BR /&gt;name = $1; uid = $3; rname = $5&lt;BR /&gt;...&lt;BR /&gt;END { print name, uid, rname } '</description>
      <pubDate>Thu, 11 Sep 2008 15:15:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266804#M333596</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-09-11T15:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266805#M333597</link>
      <description>Denis,&lt;BR /&gt;&lt;BR /&gt;Thanks alot for your help, could you please help me a little bit more. Can you please little more explain working of your script so that I can modify it further?</description>
      <pubDate>Thu, 11 Sep 2008 16:37:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266805#M333597</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2008-09-11T16:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266806#M333598</link>
      <description>&lt;!--!*#--&gt;&amp;gt;Can you please little more explain working of your script so that I can modify it further?&lt;BR /&gt;&lt;BR /&gt;From the one in:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1263622" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1263622&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;sort passwd1 passwd2 passwd3 | awk -F: '&lt;BR /&gt;function do_print() { # centralzed&lt;BR /&gt;   save_line = name " " uid " " rname # add uid and real name&lt;BR /&gt;   # get the info from last&lt;BR /&gt;   last_command = "last -1 " name&lt;BR /&gt;   name = $1; uid = $3; rname = $5&lt;BR /&gt;   FS=" "&lt;BR /&gt;   xx = last_command | getline&lt;BR /&gt;   if (xx == 1)&lt;BR /&gt;      print save_line, $3, $4, $5, $6&lt;BR /&gt;   else&lt;BR /&gt;      print save_line, "???"&lt;BR /&gt;   FS=":" # restore&lt;BR /&gt;}&lt;BR /&gt;BEGIN { getline; name = $1; uid = $3; rname = $5 } # read first line&lt;BR /&gt;{&lt;BR /&gt;if ($1 == name) {  # combine same UIDs&lt;BR /&gt;   uid = uid " " $3&lt;BR /&gt;} else {&lt;BR /&gt;   do_print() # if a break, print previous&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;END { do_print() } '</description>
      <pubDate>Thu, 11 Sep 2008 16:58:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266806#M333598</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-09-11T16:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266807#M333599</link>
      <description>Thank you very much, is that c shell scripting ?</description>
      <pubDate>Thu, 11 Sep 2008 17:05:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266807#M333599</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2008-09-11T17:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266808#M333600</link>
      <description>hI:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; is that c shell scripting ?&lt;BR /&gt;&lt;BR /&gt;No, Dennis used 'awk'.  This is invoked with the command 'awk'.  The actual script is encapsulated between the single quote marks.  A rather nice tutorial can be found here, although the tutorial is the enhanced GNU 'awk' which adds features not present in HP's more standard version.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.gnu.org/software/gawk/manual/" target="_blank"&gt;http://www.gnu.org/software/gawk/manual/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 11 Sep 2008 17:41:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266808#M333600</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-09-11T17:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266809#M333601</link>
      <description>&amp;gt;is that c shell scripting?&lt;BR /&gt;&lt;BR /&gt;I wouldn't be caught dead using the scummy C shell.  ;-)&lt;BR /&gt;&lt;BR /&gt;You can also put the awk script in a file and invoke with: awk -f foo.awk</description>
      <pubDate>Thu, 11 Sep 2008 18:09:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-a-script/m-p/4266809#M333601</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-09-11T18:09:55Z</dc:date>
    </item>
  </channel>
</rss>

