<?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 question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054056#M304977</link>
    <description>Sandman,&lt;BR /&gt;&lt;BR /&gt;I like your oneline script.&lt;BR /&gt;very simple...  =)</description>
    <pubDate>Mon, 13 Aug 2007 12:34:51 GMT</pubDate>
    <dc:creator>Juan M Leon</dc:creator>
    <dc:date>2007-08-13T12:34:51Z</dc:date>
    <item>
      <title>script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054051#M304972</link>
      <description>Hello ,&lt;BR /&gt;i have 2 files called users and /etc/passwd.&lt;BR /&gt;I need to grep the users from /etc/passwd .&lt;BR /&gt;I'm using the below script ,...what is wrong.please advice&lt;BR /&gt;for i in $users ; do&lt;BR /&gt;&amp;gt;grep $i /etc/passwd &amp;gt;/tmp/users1&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks much&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Aug 2007 12:01:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054051#M304972</guid>
      <dc:creator>navin</dc:creator>
      <dc:date>2007-08-13T12:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054052#M304973</link>
      <description>Navin,&lt;BR /&gt;&lt;BR /&gt;You need a small modification in your script&lt;BR /&gt;&lt;BR /&gt;for i in `cat users` ; do&lt;BR /&gt; grep $i /etc/passwd &amp;gt;&amp;gt; /tmp/users1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;"cat users " I assume that the file is users and it has one field per record with the UID&lt;BR /&gt;&lt;BR /&gt;"&amp;gt;&amp;gt;" You need to put double redirect. otherwise you will only have the last successful record in the users1 file.&lt;BR /&gt;&amp;gt;&amp;gt; means add at the end where &amp;gt; means clear and add in this file.&lt;BR /&gt;&lt;BR /&gt;good luck</description>
      <pubDate>Mon, 13 Aug 2007 12:06:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054052#M304973</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-13T12:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054053#M304974</link>
      <description>Note : Please dont forget to assign points.&lt;BR /&gt;Thank you</description>
      <pubDate>Mon, 13 Aug 2007 12:08:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054053#M304974</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-13T12:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054054#M304975</link>
      <description>Or sans cat:&lt;BR /&gt;&lt;BR /&gt;for i in $(&lt;USERS&gt;&lt;/USERS&gt;grep $i /etc/passwd &amp;gt;/tmp/users1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Mon, 13 Aug 2007 12:15:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054054#M304975</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-08-13T12:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054055#M304976</link>
      <description>To print all users that have an entry in the "users file" and a corresponding entry in the /etc/passwd file use the following:&lt;BR /&gt;&lt;BR /&gt;# grep -f &lt;USERS filename=""&gt; /etc/passwd&lt;/USERS&gt;</description>
      <pubDate>Mon, 13 Aug 2007 12:33:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054055#M304976</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-13T12:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054056#M304977</link>
      <description>Sandman,&lt;BR /&gt;&lt;BR /&gt;I like your oneline script.&lt;BR /&gt;very simple...  =)</description>
      <pubDate>Mon, 13 Aug 2007 12:34:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054056#M304977</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-13T12:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054057#M304978</link>
      <description>&lt;!--!*#--&gt;The problem with the ways mentioned is that they will look for ALL occurrences of whatever is in the users file.&lt;BR /&gt;&lt;BR /&gt;Say you have a file like:&lt;BR /&gt;&lt;BR /&gt;tom&lt;BR /&gt;dick&lt;BR /&gt;harry&lt;BR /&gt;&lt;BR /&gt;When you grep as the folks have done above you could get the users:&lt;BR /&gt;&lt;BR /&gt;tom&lt;BR /&gt;tomsmit&lt;BR /&gt;dick&lt;BR /&gt;dickjr&lt;BR /&gt;harry&lt;BR /&gt;harry2&lt;BR /&gt;&lt;BR /&gt;It would also be possible to gets matches in other areas of each line, like the home directory or GECOS field.&lt;BR /&gt;&lt;BR /&gt;If you want to look for specific user names only you could do:&lt;BR /&gt;&lt;BR /&gt;for i in $(&lt;USERS&gt;&lt;/USERS&gt;  grep ^${i}: /etc/passwd &amp;gt;/tmp/users1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;The '^${i}:' will look for ${i} ONLY at the beginning of each line with a ':' after it.  So it would show only:&lt;BR /&gt;&lt;BR /&gt;tom:*:UID:GID:GECOS:homedir:shell&lt;BR /&gt;dick:*:UID:GID:GECOS:homedir:shell&lt;BR /&gt;harry:*:UID:GID:GECOS:homedir:shell</description>
      <pubDate>Mon, 13 Aug 2007 13:15:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/4054057#M304978</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-08-13T13:15:54Z</dc:date>
    </item>
  </channel>
</rss>

