<?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 for multiple searches in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083709#M726760</link>
    <description>"&lt;BR /&gt;I know I can do&lt;BR /&gt;&lt;BR /&gt;last|grep ftpelp1 |grep "Apr 27"&lt;BR /&gt;&lt;BR /&gt;but can I do like in linux:&lt;BR /&gt;&lt;BR /&gt;last |grep -e ftpelp1 -e "Apr 27"&lt;BR /&gt;"&lt;BR /&gt;&lt;BR /&gt;no...No....NO!&lt;BR /&gt;&lt;BR /&gt;the results of the above are entirely different from each other.  You said: "so I want all entries with ftpelp1 and Apr 27."...not a really clear problem definition.&lt;BR /&gt;&lt;BR /&gt;If you want a list of all lines containing both "ftpelp1" and "Apr 27", the use the code as noted in your first example above&lt;BR /&gt;&lt;BR /&gt;I you want all lines containing either (or both) "ftpelp1" or "Apr 27", then the second is sufficient....</description>
    <pubDate>Tue, 11 Dec 2007 19:50:40 GMT</pubDate>
    <dc:creator>OldSchool</dc:creator>
    <dc:date>2007-12-11T19:50:40Z</dc:date>
    <item>
      <title>grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083703#M726754</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;can I use a single grep for multiple searches on the same input line:&lt;BR /&gt;&lt;BR /&gt;ftpelp1   pts/1        &lt;IPRANGE&gt;          Apr 27 17:32 - 18:26  (00:53)&lt;BR /&gt;&lt;BR /&gt;so I want all entries with ftpelp1 and Apr 27.&lt;BR /&gt;&lt;BR /&gt;I know I can do&lt;BR /&gt;&lt;BR /&gt;last|grep ftpelp1 |grep "Apr 27"&lt;BR /&gt;&lt;BR /&gt;but can I do like in linux:&lt;BR /&gt;&lt;BR /&gt;last |grep -e ftpelp1 -e "Apr 27"&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris.&lt;BR /&gt;&lt;/IPRANGE&gt;</description>
      <pubDate>Tue, 11 Dec 2007 13:52:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083703#M726754</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-12-11T13:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083704#M726755</link>
      <description>Shalom Chris,&lt;BR /&gt;&lt;BR /&gt;The man page shows -e as a valid option in grep for patter matching.&lt;BR /&gt;&lt;BR /&gt;Would it not be easier to just test it on HP-UX?&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 11 Dec 2007 13:56:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083704#M726755</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-12-11T13:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083705#M726756</link>
      <description>HI Chris ,&lt;BR /&gt;&lt;BR /&gt;with the help of -e option you can do multiple search.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Aneesh</description>
      <pubDate>Tue, 11 Dec 2007 13:59:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083705#M726756</guid>
      <dc:creator>Aneesh Mohan</dc:creator>
      <dc:date>2007-12-11T13:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083706#M726757</link>
      <description>Or just use egrep&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;last | egrep "ftpelp1|Apr 27"&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 11 Dec 2007 14:04:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083706#M726757</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-12-11T14:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083707#M726758</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;...or use the '-E' option to enable extended regular expressions:&lt;BR /&gt;&lt;BR /&gt;# last|grep -E "ftpelp1|Apr 27"&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 11 Dec 2007 14:08:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083707#M726758</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-12-11T14:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083708#M726759</link>
      <description>ok thanks guys,&lt;BR /&gt;&lt;BR /&gt;looks like grep does work slightly different from 1 OS to the next.&lt;BR /&gt;&lt;BR /&gt;but some good examples here that I can adapt across AIX Linux Tru64 and HPUX.&lt;BR /&gt;&lt;BR /&gt;cheers.&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Tue, 11 Dec 2007 14:58:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083708#M726759</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-12-11T14:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083709#M726760</link>
      <description>"&lt;BR /&gt;I know I can do&lt;BR /&gt;&lt;BR /&gt;last|grep ftpelp1 |grep "Apr 27"&lt;BR /&gt;&lt;BR /&gt;but can I do like in linux:&lt;BR /&gt;&lt;BR /&gt;last |grep -e ftpelp1 -e "Apr 27"&lt;BR /&gt;"&lt;BR /&gt;&lt;BR /&gt;no...No....NO!&lt;BR /&gt;&lt;BR /&gt;the results of the above are entirely different from each other.  You said: "so I want all entries with ftpelp1 and Apr 27."...not a really clear problem definition.&lt;BR /&gt;&lt;BR /&gt;If you want a list of all lines containing both "ftpelp1" and "Apr 27", the use the code as noted in your first example above&lt;BR /&gt;&lt;BR /&gt;I you want all lines containing either (or both) "ftpelp1" or "Apr 27", then the second is sufficient....</description>
      <pubDate>Tue, 11 Dec 2007 19:50:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083709#M726760</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2007-12-11T19:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: grep for multiple searches</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083710#M726761</link>
      <description>You have three ways to search for multiple patterns (OR) without going to the dark side and using egrep:&lt;BR /&gt;1) use -e for each&lt;BR /&gt;2) use -f and put them in a file&lt;BR /&gt;3) use a newline:&lt;BR /&gt;$ grep "foo&lt;BR /&gt;bar" file&lt;BR /&gt;&lt;BR /&gt;If you want to use grep to do an AND you can use:&lt;BR /&gt;1) piped greps like you had.&lt;BR /&gt;2) big regular expressions:&lt;BR /&gt;$ grep "ftpelp1.*Apr 27"&lt;BR /&gt;&lt;BR /&gt;If you want either order, you would need to use two -e with the words reversed.</description>
      <pubDate>Wed, 12 Dec 2007 01:49:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-for-multiple-searches/m-p/5083710#M726761</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-12T01:49:17Z</dc:date>
    </item>
  </channel>
</rss>

