<?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 something AND something in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176655#M162162</link>
    <description>If you are trying to match multiple patterns then use -e option in grep &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 28 Jan 2004 13:29:28 GMT</pubDate>
    <dc:creator>Uday_S_Ankolekar</dc:creator>
    <dc:date>2004-01-28T13:29:28Z</dc:date>
    <item>
      <title>grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176650#M162157</link>
      <description>I am trying to grep a file, that has this AND that.&lt;BR /&gt;&lt;BR /&gt;grep "s" &amp;amp;&amp;amp; "oracle"&lt;BR /&gt;&lt;BR /&gt;does not seem to work.</description>
      <pubDate>Wed, 28 Jan 2004 13:03:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176650#M162157</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-01-28T13:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176651#M162158</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Your question isn't quite clear to me. If you are searching for lines that contain both s and oracle, a simple way is&lt;BR /&gt;&lt;BR /&gt;grep "oracle" file|grep "s"&lt;BR /&gt;&lt;BR /&gt;If you are looking for lines that contain either s or oracle or both then&lt;BR /&gt;&lt;BR /&gt;grep -E -i 'oracle|s' file&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;grep -i -e 'oracle' -e 's' file&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Wed, 28 Jan 2004 13:11:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176651#M162158</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-01-28T13:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176652#M162159</link>
      <description>How about &lt;BR /&gt;&lt;BR /&gt;grep "s" |grep "oracle"&lt;BR /&gt;&lt;BR /&gt;?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 28 Jan 2004 13:11:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176652#M162159</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2004-01-28T13:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176653#M162160</link>
      <description>I have tried that, but I need it to contain BOTH!</description>
      <pubDate>Wed, 28 Jan 2004 13:13:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176653#M162160</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-01-28T13:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176654#M162161</link>
      <description>Can you give us an example?&lt;BR /&gt;&lt;BR /&gt;$cat data&lt;BR /&gt;&lt;BR /&gt;oracle a fine word&lt;BR /&gt;s is a letter&lt;BR /&gt;s  not there in oracle&lt;BR /&gt;ofcourse s is not there in oracle&lt;BR /&gt;but o in oracle&lt;BR /&gt;&lt;BR /&gt;$grep oracle data |grep s&lt;BR /&gt;s  not there in oracle&lt;BR /&gt;ofcourse s is not there in oracle&lt;BR /&gt;&lt;BR /&gt;??&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Jan 2004 13:16:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176654#M162161</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-01-28T13:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176655#M162162</link>
      <description>If you are trying to match multiple patterns then use -e option in grep &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Jan 2004 13:29:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176655#M162162</guid>
      <dc:creator>Uday_S_Ankolekar</dc:creator>
      <dc:date>2004-01-28T13:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176656#M162163</link>
      <description>As Sri points out, the pipe construct ( grep "s" | grep "oracle" ) should give you what you're looking for.  Can you provide details of how/where you think it's failing?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 28 Jan 2004 13:35:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176656#M162163</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2004-01-28T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176657#M162164</link>
      <description>He's trying to do a grep with an AND.&lt;BR /&gt;&lt;BR /&gt;Give me the lines where BOTH "s" and "oracle" appear in the same line.&lt;BR /&gt;&lt;BR /&gt;grep ("s" -a "oracle") file&lt;BR /&gt;&lt;BR /&gt;I can't think of any way to do it!</description>
      <pubDate>Wed, 28 Jan 2004 13:43:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176657#M162164</guid>
      <dc:creator>Stuart Abramson_2</dc:creator>
      <dc:date>2004-01-28T13:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176658#M162165</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you can try:&lt;BR /&gt;grep -E ".*text1.*text2|.*text2.*text1" file&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Jan 2004 14:04:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176658#M162165</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-01-28T14:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176659#M162166</link>
      <description>Right... &lt;BR /&gt;The leading '.*' for 'any characters' do not seem to be needed, giving:&lt;BR /&gt;&lt;BR /&gt;grep -E "oracle.*s|s.*oracle" &lt;BR /&gt;&lt;BR /&gt;but normally you grab for a double grep...&lt;BR /&gt;&lt;BR /&gt;Hein.</description>
      <pubDate>Wed, 28 Jan 2004 16:47:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176659#M162166</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-01-28T16:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176660#M162167</link>
      <description>Sri's answer is right -- I do this all the time .. &lt;BR /&gt;grep -i -e 'oracle' -e 's' file&lt;BR /&gt;&lt;BR /&gt;Note -- BOTH THINGS YOU ARE LOOKING FOR *MUST* have the -e in front of it.  That screwed me up before I got the hang of it and I think this could be what you are missing.  The following command does not work because it's missing the other "-e":&lt;BR /&gt;  grep -i oracle -e file&lt;BR /&gt;&lt;BR /&gt;(Note, the -i is optional so that it's case-insensitive)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Jan 2004 16:58:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176660#M162167</guid>
      <dc:creator>Chris Hulihan</dc:creator>
      <dc:date>2004-01-28T16:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: grep something AND something</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176661#M162168</link>
      <description>Here is my test file 3 lines&lt;BR /&gt;&lt;BR /&gt;#cat toddfile&lt;BR /&gt;s and oracle&lt;BR /&gt;s only&lt;BR /&gt;oracle only&lt;BR /&gt;&lt;BR /&gt;Here is my test...&lt;BR /&gt;&lt;BR /&gt;root:/root&lt;BR /&gt;# grep s /tmp/toddfile&lt;BR /&gt;s and oracle&lt;BR /&gt;s only&lt;BR /&gt;&lt;BR /&gt;root:/root&lt;BR /&gt;# grep -e s  -e oracle /tmp/toddfile&lt;BR /&gt;s and oracle&lt;BR /&gt;oracle only&lt;BR /&gt;s only&lt;BR /&gt;&lt;BR /&gt;root:/root&lt;BR /&gt;# grep s |grep oracle /tmp/toddfile &lt;BR /&gt;s and oracle&lt;BR /&gt;oracle only&lt;BR /&gt;&lt;BR /&gt;root:/root&lt;BR /&gt;# grep s /tmp/toddfile |grep oracle&lt;BR /&gt;s and oracle&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See the last one shows your example of only showing those lines with both s and oracle on them... &lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Wed, 28 Jan 2004 17:29:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-something-and-something/m-p/3176661#M162168</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2004-01-28T17:29:22Z</dc:date>
    </item>
  </channel>
</rss>

