<?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 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757602#M784789</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you are going to 'grep' usernames in '/etc/passwd' I suggest that you do something like:&lt;BR /&gt;&lt;BR /&gt;# grep "^tftp:" /etc/passwd&lt;BR /&gt;&lt;BR /&gt;That is, the caret (^) anchors the search to the beginning of the line.  The colon (:) matches the string at the '/etc/passwd's first field end.  This will give much more accurate matching and eliminate spurious matching.&lt;BR /&gt;&lt;BR /&gt;Do *not* spawn a new, unnecessary process by doing :&lt;BR /&gt;&lt;BR /&gt;# cat /etc/passwd | grep ...&lt;BR /&gt;&lt;BR /&gt;That is needless and wasteful.  'grep' takes its input from STDIN or the filename supplied as its last argument.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Thu, 23 Mar 2006 10:22:06 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-03-23T10:22:06Z</dc:date>
    <item>
      <title>grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757596#M784783</link>
      <description>Hi people, okay a command in grep is not working.&lt;BR /&gt;i did /etc/passwd | grep &lt;USERNAME&gt;&lt;BR /&gt;Now, that username was there, but the output that i got was /etc/passwd[14]: mysql:*:102:102::/home/mysql:/sbin/sh:  not found. And the list went on like this. &lt;BR /&gt;Now, to my understanding, u put in a file name and then concatenate it with grep to find a particular string in that file or what ever is it that u r lookig it in. &lt;BR /&gt;So, how come the grep is giving me  alist of all the usernames when all i am grepping is a particular and unique username.&lt;/USERNAME&gt;</description>
      <pubDate>Thu, 23 Mar 2006 09:55:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757596#M784783</guid>
      <dc:creator>khilari</dc:creator>
      <dc:date>2006-03-23T09:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757597#M784784</link>
      <description>shalom,&lt;BR /&gt;&lt;BR /&gt;Try grep username /etc/passwd&lt;BR /&gt;&lt;BR /&gt;You might get better results. You'll certainly get them more efficiently.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Mar 2006 09:59:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757597#M784784</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-03-23T09:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757598#M784785</link>
      <description>Hi Khilari, &lt;BR /&gt;&lt;BR /&gt;You should rather use, &lt;BR /&gt;&lt;BR /&gt;# grep -i mysql /etc/passwd &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Thu, 23 Mar 2006 10:06:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757598#M784785</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-03-23T10:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757599#M784786</link>
      <description>Khilari,&lt;BR /&gt;as a second option :&lt;BR /&gt;You may have missed out "cat " in front of the /etc/passwd.&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Mar 2006 10:13:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757599#M784786</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-03-23T10:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757600#M784787</link>
      <description>If all you did was:&lt;BR /&gt;&lt;BR /&gt;# /etc/passwd | grep &lt;USERNAME&gt;&lt;BR /&gt;&lt;BR /&gt;Then no, that will not work. Your example would try to execute the /etc/passwd file, which would not work and would error on each and every line.  You got all lines, because 1) they are not valid shell script commands and 2) grep works on 'standard out' file descriptor and everything you saw was going to 'standard error' file descriptor.&lt;BR /&gt;&lt;BR /&gt;You must cat the file and pipe to grep:&lt;BR /&gt;&lt;BR /&gt;# cat /etc/passwd | grep &lt;USERNAME&gt;&lt;BR /&gt;&lt;BR /&gt;or you can just use the grep command and specify the file name you are querying at the end of the command, as previous post suggested.&lt;BR /&gt;&lt;BR /&gt;# grep &lt;USERNAME&gt; /etc/passwd&lt;/USERNAME&gt;&lt;/USERNAME&gt;&lt;/USERNAME&gt;</description>
      <pubDate>Thu, 23 Mar 2006 10:17:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757600#M784787</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-03-23T10:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757601#M784788</link>
      <description>&amp;gt;&amp;gt; Hi people, okay a command in grep is not working.&lt;BR /&gt;&lt;BR /&gt;Hmm... the unix world as we know it would come to a grinding hold if grep was as badly broken as you suggest.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; i did /etc/passwd | grep &lt;USERNAME&gt;&lt;BR /&gt;&lt;BR /&gt;Ah.... you missed a 'cat ' in front of that, or just use the preferred 'grep &lt;STRING&gt; &lt;FILE&gt;' as already replied.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; output that i got was /etc/passwd[14]: mysql:*:102:102::/home/mysql:/sbin/sh: not found. And the list went on like this. &lt;BR /&gt;&lt;BR /&gt;Seems to me you are actually EXECUTING passwd as a script and indeed 'mysql' would be a command which is not found.&lt;BR /&gt;&lt;BR /&gt;What is the MODE on /etc/passwd&lt;BR /&gt;You should not have an x (execute) bit there.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;/FILE&gt;&lt;/STRING&gt;&lt;/USERNAME&gt;</description>
      <pubDate>Thu, 23 Mar 2006 10:18:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757601#M784788</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-23T10:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757602#M784789</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you are going to 'grep' usernames in '/etc/passwd' I suggest that you do something like:&lt;BR /&gt;&lt;BR /&gt;# grep "^tftp:" /etc/passwd&lt;BR /&gt;&lt;BR /&gt;That is, the caret (^) anchors the search to the beginning of the line.  The colon (:) matches the string at the '/etc/passwd's first field end.  This will give much more accurate matching and eliminate spurious matching.&lt;BR /&gt;&lt;BR /&gt;Do *not* spawn a new, unnecessary process by doing :&lt;BR /&gt;&lt;BR /&gt;# cat /etc/passwd | grep ...&lt;BR /&gt;&lt;BR /&gt;That is needless and wasteful.  'grep' takes its input from STDIN or the filename supplied as its last argument.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 23 Mar 2006 10:22:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757602#M784789</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-03-23T10:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757603#M784790</link>
      <description># grep -i mysql /etc/passwd&lt;BR /&gt;mysql:*:102:102::/home/mysql:/sbin/sh&lt;BR /&gt;# cat /etc/passwd | grep mysql&lt;BR /&gt;mysql:*:102:102::/home/mysql:/sbin/sh&lt;BR /&gt;&lt;BR /&gt;Now, y first the grep was before the /etc/passwd and in the other case after it. Yet giving the same output. &lt;BR /&gt;&lt;BR /&gt;Do u huys ever use egrep or fgrep on a regular basis.</description>
      <pubDate>Thu, 23 Mar 2006 12:54:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757603#M784790</guid>
      <dc:creator>khilari</dc:creator>
      <dc:date>2006-03-23T12:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757604#M784791</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;If you use the '-E' and '-F' switches with 'grep' you get the functionalty of 'egrep' and 'fgrep' respectively.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 23 Mar 2006 13:01:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757604#M784791</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-03-23T13:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757605#M784792</link>
      <description>&lt;BR /&gt;&amp;gt;&amp;gt; Now, y first the grep was before the /etc/passwd and in the other case after it. Yet giving the same output. &lt;BR /&gt;&lt;BR /&gt;That's very basic Unix shell behaviour.&lt;BR /&gt;&lt;BR /&gt;The syntax for grep and many other commands (zip, head, wc,...) is:   &lt;BR /&gt;&lt;BR /&gt;command &lt;SWITCHES&gt; &lt;OPTIONS&gt; &lt;DATA_TO_ACT_ON&gt;&lt;BR /&gt;&lt;BR /&gt;If no filename for &lt;DATA_TO_ACT_ON&gt; is provided then &lt;STDIN&gt; in used.&lt;BR /&gt;&lt;BR /&gt;In the second case, you did not give am explicit filespace to grep, so it read STDIN which got it's data piped in from the preceding pipe command.&lt;BR /&gt;&lt;BR /&gt;Clear as mud?&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STDIN&gt;&lt;/DATA_TO_ACT_ON&gt;&lt;/DATA_TO_ACT_ON&gt;&lt;/OPTIONS&gt;&lt;/SWITCHES&gt;</description>
      <pubDate>Thu, 23 Mar 2006 14:05:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757605#M784792</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-23T14:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757606#M784793</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try use:&lt;BR /&gt;&lt;BR /&gt;# pwget -n username&lt;BR /&gt;&lt;BR /&gt;I think is better</description>
      <pubDate>Thu, 23 Mar 2006 15:02:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757606#M784793</guid>
      <dc:creator>Carlos Roberto Schimidt</dc:creator>
      <dc:date>2006-03-23T15:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757607#M784794</link>
      <description>Hi, &lt;BR /&gt;   I think, you missed out "cat". Then it will fail.&lt;BR /&gt;&lt;BR /&gt;Use this;&lt;BR /&gt;cat /etc/passwd | grep -i &lt;USERNAME&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Prabu.S&lt;/USERNAME&gt;</description>
      <pubDate>Fri, 24 Mar 2006 00:48:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757607#M784794</guid>
      <dc:creator>Senthil Prabu.S_1</dc:creator>
      <dc:date>2006-03-24T00:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757608#M784795</link>
      <description># grep -i mysql /etc/passwd&lt;BR /&gt;mysql:*:102:102::/home/mysql:/sbin/sh&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Some utilities like grep, perl, sed are having capability to open file in the utility itself. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# cat /etc/passwd | grep mysql&lt;BR /&gt;mysql:*:102:102::/home/mysql:/sbin/sh&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;here, grep is getting input from STANDARD INPUT mode using pipe command.&lt;BR /&gt;&lt;BR /&gt;You can use another method as,&lt;BR /&gt;&lt;BR /&gt;grep -i mysql &amp;lt; /etc/passwd&lt;BR /&gt;&lt;BR /&gt;&amp;lt; file will give inputs to some command. &amp;lt; file is more faster than cat &lt;FILE&gt; |&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu&lt;/FILE&gt;</description>
      <pubDate>Fri, 24 Mar 2006 00:52:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757608#M784795</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-24T00:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757609#M784796</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you pls run either,&lt;BR /&gt;&lt;BR /&gt;#cat /etc/passwd | grep &lt;USERNAME&gt;&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;#grep &lt;USERNAME&gt; /etc/passwd&lt;BR /&gt;&lt;BR /&gt;It should be OKay,&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Siva&lt;/USERNAME&gt;&lt;/USERNAME&gt;</description>
      <pubDate>Fri, 24 Mar 2006 05:54:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep/m-p/3757609#M784796</guid>
      <dc:creator>Sivakumar TS</dc:creator>
      <dc:date>2006-03-24T05:54:26Z</dc:date>
    </item>
  </channel>
</rss>

