<?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: AWK:  matching 2 or more  Patterns in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479410#M680366</link>
    <description>&lt;BR /&gt;&amp;gt;Why? The whole purpose of a pattern in awk is to not use an extra grep process.&lt;BR /&gt;&lt;BR /&gt;Do you mean with extra grep usage here will affect runtime ? awk will work faster ?&lt;BR /&gt; &lt;BR /&gt;&amp;gt;And using the "|" in egrep is the same as "|" in awk.&lt;BR /&gt;&lt;BR /&gt;I know , just wanted to show alternative way. .&lt;BR /&gt;&lt;BR /&gt;&amp;gt;But if you want to use grep, don't use the egrep hammer for this simple case, use multiple "-e patterns".&lt;BR /&gt;&lt;BR /&gt;Yes, I know grep -E 'pattern1|pattern2' == egrep 'pattern1|pattern2' . &lt;BR /&gt;And you prefer grep in case of egrep not available in the system or what ? Can you explain Dennis ?&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
    <pubDate>Tue, 18 Aug 2009 09:59:20 GMT</pubDate>
    <dc:creator>Hakki Aydin Ucar</dc:creator>
    <dc:date>2009-08-18T09:59:20Z</dc:date>
    <item>
      <title>AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479405#M680361</link>
      <description>I would like to match 2 or more patterns being passed to AWK out of the sream passed to it. &lt;BR /&gt;&lt;BR /&gt;With 1 stream:&lt;BR /&gt;&lt;BR /&gt;someprog | awk F: '/pattern1/ {print $3}'&lt;BR /&gt;&lt;BR /&gt;What if I have 2 or more patterns? Is it possible so I do not resort to multiple awk lines?&lt;BR /&gt;&lt;BR /&gt;TIA... sorry I am getting rusty with the Shell and its utils.&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Aug 2009 19:53:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479405#M680361</guid>
      <dc:creator>Alzhy</dc:creator>
      <dc:date>2009-08-13T19:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479406#M680362</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Consider:&lt;BR /&gt;&lt;BR /&gt;# X="line-1 ok\nline-2 not ok\nline-3 ok"&lt;BR /&gt;# echo ${X}|awk '/line-1|line-3/ {print}'&lt;BR /&gt;line-1 ok&lt;BR /&gt;line-3 ok&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Aug 2009 19:58:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479406#M680362</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-13T19:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479407#M680363</link>
      <description>&amp;gt;What if I have 2 or more patterns?&lt;BR /&gt;&lt;BR /&gt;Besides JRF's ERE, you can use multiple patterns with ||:&lt;BR /&gt;'/line-1/ || /line-3/ { print }'</description>
      <pubDate>Fri, 14 Aug 2009 07:09:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479407#M680363</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-08-14T07:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479408#M680364</link>
      <description>maybe egrep can be used according to your case:&lt;BR /&gt;&lt;BR /&gt;# echo $output | egrep 'pattern1|pattern2|pattern3'</description>
      <pubDate>Tue, 18 Aug 2009 05:13:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479408#M680364</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2009-08-18T05:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479409#M680365</link>
      <description>&amp;gt;Hakki: maybe egrep can be used according to your case:&lt;BR /&gt;&lt;BR /&gt;Why?  The whole purpose of a pattern in awk is to not use an extra grep process.&lt;BR /&gt;And using the "|" in egrep is the same as "|" in awk.&lt;BR /&gt;But if you want to use grep, don't use the egrep hammer for this simple case, use multiple "-e patterns".&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Aug 2009 08:10:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479409#M680365</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-08-18T08:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479410#M680366</link>
      <description>&lt;BR /&gt;&amp;gt;Why? The whole purpose of a pattern in awk is to not use an extra grep process.&lt;BR /&gt;&lt;BR /&gt;Do you mean with extra grep usage here will affect runtime ? awk will work faster ?&lt;BR /&gt; &lt;BR /&gt;&amp;gt;And using the "|" in egrep is the same as "|" in awk.&lt;BR /&gt;&lt;BR /&gt;I know , just wanted to show alternative way. .&lt;BR /&gt;&lt;BR /&gt;&amp;gt;But if you want to use grep, don't use the egrep hammer for this simple case, use multiple "-e patterns".&lt;BR /&gt;&lt;BR /&gt;Yes, I know grep -E 'pattern1|pattern2' == egrep 'pattern1|pattern2' . &lt;BR /&gt;And you prefer grep in case of egrep not available in the system or what ? Can you explain Dennis ?&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Tue, 18 Aug 2009 09:59:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479410#M680366</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2009-08-18T09:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: AWK:  matching 2 or more  Patterns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479411#M680367</link>
      <description>&amp;gt;Hakki: Do you mean with extra grep usage here will affect runtime? awk will work faster?&lt;BR /&gt;&lt;BR /&gt;Possibly.  If invoking awk anyway, why add a grep.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;And you prefer grep in case of egrep not available in the system or what?&lt;BR /&gt;&lt;BR /&gt;Instead of egrep's ERE, use grep's RE:&lt;BR /&gt;grep -e pattern1 -e pattern2</description>
      <pubDate>Tue, 18 Aug 2009 15:03:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-matching-2-or-more-patterns/m-p/4479411#M680367</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-08-18T15:03:02Z</dc:date>
    </item>
  </channel>
</rss>

