<?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 Question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984939#M123041</link>
    <description>hiccup ... hiccup ...</description>
    <pubDate>Fri, 30 May 2003 04:54:34 GMT</pubDate>
    <dc:creator>Michael Tully</dc:creator>
    <dc:date>2003-05-30T04:54:34Z</dc:date>
    <item>
      <title>Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984937#M123039</link>
      <description>Hi, I have a list of names and I need to check to see if any of them exist on the unix system. There are like 200 of them, and I dont feel like using grep for each one! lol I tried writing a script to grep the names out of the passwd file, but I am not having much luck. I would appreciate it if someone could point me in the right direction as to which commands I should use, or has already got a script to perfom a similar task.&lt;BR /&gt;&lt;BR /&gt;the names in the list are written in the following format.&lt;BR /&gt;&lt;BR /&gt;joe bloggs&lt;BR /&gt;harry potter&lt;BR /&gt;incredible hulk&lt;BR /&gt;space cow&lt;BR /&gt;&lt;BR /&gt;but there are like 200 of them...&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;&lt;BR /&gt;Andrew</description>
      <pubDate>Fri, 30 May 2003 03:53:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984937#M123039</guid>
      <dc:creator>Andrew Beal</dc:creator>
      <dc:date>2003-05-30T03:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984938#M123040</link>
      <description>This might get some of them...&lt;BR /&gt;&lt;BR /&gt;grep -if - /etc/passwd &amp;lt; namelist.txt&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 May 2003 04:36:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984938#M123040</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2003-05-30T04:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984939#M123041</link>
      <description>hiccup ... hiccup ...</description>
      <pubDate>Fri, 30 May 2003 04:54:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984939#M123041</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2003-05-30T04:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984940#M123042</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Try this :-&lt;BR /&gt;&lt;BR /&gt;cat /etc/passwd | sed 's/:/ /' | awk '{print $1}' | sed 's/^/ /' | sed 's/ /last /' &amp;gt;/tmp/name check&lt;BR /&gt;&lt;BR /&gt;then diff the /tmp/namecheck against your name list.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You also might find this useful :-&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x37857d4cf554d611abdb0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x37857d4cf554d611abdb0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Fri, 30 May 2003 08:58:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984940#M123042</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2003-05-30T08:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984941#M123043</link>
      <description>Hi Andrew,&lt;BR /&gt;you could try something like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read firstname lastname&lt;BR /&gt;do&lt;BR /&gt;        grep -iE "${firstname}[[:space:]]*${lastname}" /etc/passwd&lt;BR /&gt;done &amp;lt;$1 &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;run it like this:&lt;BR /&gt;# myscript.sh namefile&lt;BR /&gt;&lt;BR /&gt;handles multiple spaces between first and second names in /etc/passwd. Names in namefile consisting of other than two names will also be processed, however literally.&lt;BR /&gt;If the content of your namefile causes an entry to be output more than once, then execute like this:&lt;BR /&gt;# myscript.sh namefile | sort -u&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Fri, 30 May 2003 09:00:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984941#M123043</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-05-30T09:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984942#M123044</link>
      <description>Oh they did go through! What's up with that? When I clicked submit, nothing happened... probably the browser. Sorry!</description>
      <pubDate>Fri, 30 May 2003 15:45:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984942#M123044</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2003-05-30T15:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984943#M123045</link>
      <description>I'd just do something like:&lt;BR /&gt;for NAME in `cat $MYFILE`&lt;BR /&gt;do&lt;BR /&gt;    grep $NAME /etc/passwd&lt;BR /&gt;    if test "$?" -eq "0"&lt;BR /&gt;    then&lt;BR /&gt;          echo $NAME&amp;gt;&amp;gt;FOUNDFILE&lt;BR /&gt;    else&lt;BR /&gt;          echo $NAME&amp;gt;&amp;gt;NOTFOUNDFILE&lt;BR /&gt;    fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This would give you two files, one with the names of the users that were in the password table, and another with the names that weren't.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Fri, 30 May 2003 15:49:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984943#M123045</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-05-30T15:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984944#M123046</link>
      <description>Hi Andrew:&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;for NAME in `cat filewnames`&lt;BR /&gt;do&lt;BR /&gt;grep -x $NAME /etc/passwd &amp;gt;&amp;gt; output.txt&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Make sure you create the output.txt file before executing the for i statement.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;DR</description>
      <pubDate>Fri, 30 May 2003 15:55:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984944#M123046</guid>
      <dc:creator>Dario_1</dc:creator>
      <dc:date>2003-05-30T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984945#M123047</link>
      <description>Hi,&lt;BR /&gt;Have a look at the join command (man join) , it matches fields from two files  .&lt;BR /&gt;The files must be sorted on the matching field (you have to create a temporary file for the sorted password file).&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 May 2003 16:08:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984945#M123047</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-05-30T16:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984946#M123048</link>
      <description>Hi,&lt;BR /&gt;Simple example of the join command:&lt;BR /&gt;sort -t : -k 5 /etc/passwd &amp;gt;tmp1&lt;BR /&gt;sort list &amp;gt;tmp2&lt;BR /&gt;join -t : -j1 1 -j2 5 -o 1.1  tmp2 tmp1&lt;BR /&gt;&lt;BR /&gt;Prints out the name from list for each matching line in passwd.&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Fri, 30 May 2003 16:25:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2984946#M123048</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-05-30T16:25:24Z</dc:date>
    </item>
  </channel>
</rss>

