<?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: Grep command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861266#M820694</link>
    <description>Writing your file as:&lt;BR /&gt;^user1:&lt;BR /&gt;^user2:&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you can use the -f flag for grep:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;grep -w -f 50users_file /etc/passwd.</description>
    <pubDate>Tue, 10 Dec 2002 16:28:38 GMT</pubDate>
    <dc:creator>Carlos Fernandez Riera</dc:creator>
    <dc:date>2002-12-10T16:28:38Z</dc:date>
    <item>
      <title>Grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861263#M820691</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;We are planning to move some 50 users from one system to the other. I have a list user IDs for those 50 users. I am planning to create user accounts for them on the new machine by taking the /etc/passwd entries from the old machine. Now how do I grep the /etc/passwd file so that the user id is matched only with the first word of the passwd file (ie. the user ID field). Because when I do the follwoing,&lt;BR /&gt;&lt;BR /&gt;for i in `cat 50users`&lt;BR /&gt;do&lt;BR /&gt;grep -w $i /etc/passwd &amp;gt;&amp;gt; /tmp/50passwdentries&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;The user id which is present in the comment field of passwd file is also taken in to consideration so that I am ending up with having duplicate entries. Pl. help.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;Karthik</description>
      <pubDate>Tue, 10 Dec 2002 16:05:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861263#M820691</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2002-12-10T16:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861264#M820692</link>
      <description>&lt;BR /&gt;grep -w ^$i /etc/passwd &lt;BR /&gt;&lt;BR /&gt;will search at the start of the password file only. You could further delimiter it with;&lt;BR /&gt;&lt;BR /&gt;grep -w ^$i: /etc/passwd&lt;BR /&gt;&lt;BR /&gt;so that it only finds the exact userid up until the first :&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Dec 2002 16:12:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861264#M820692</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-12-10T16:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861265#M820693</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;with grep ^$i: it is able to get only 5 or 6 users. What could be the problem??&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Karthik</description>
      <pubDate>Tue, 10 Dec 2002 16:24:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861265#M820693</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2002-12-10T16:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861266#M820694</link>
      <description>Writing your file as:&lt;BR /&gt;^user1:&lt;BR /&gt;^user2:&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you can use the -f flag for grep:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;grep -w -f 50users_file /etc/passwd.</description>
      <pubDate>Tue, 10 Dec 2002 16:28:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861266#M820694</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2002-12-10T16:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861267#M820695</link>
      <description>Ive tested it with my password file, a list of all userids and our for loop command and it worked fine - it matches all exactly only once each. I didnt use the -w though - in fact its an illegal option no HP-UX. Hmm.&lt;BR /&gt;&lt;BR /&gt;Did you remove your /tmp/50passwdentries file before you run your for loop each time ?&lt;BR /&gt;&lt;BR /&gt;You will have to provide a list of your 50users and the passwd file in order to diagnose it further.&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Dec 2002 16:30:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861267#M820695</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-12-10T16:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861268#M820696</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Thank you carlos.&lt;BR /&gt;grep -w -f solved my problem.&lt;BR /&gt;&lt;BR /&gt;Stefan: grep -w works with 11i :-). Thanks for your help too.&lt;BR /&gt;&lt;BR /&gt;Karthik</description>
      <pubDate>Tue, 10 Dec 2002 17:03:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-command/m-p/2861268#M820696</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2002-12-10T17:03:18Z</dc:date>
    </item>
  </channel>
</rss>

