<?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 and | in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058274#M94457</link>
    <description>Thank you very much. :)</description>
    <pubDate>Wed, 22 Aug 2007 04:41:13 GMT</pubDate>
    <dc:creator>Markus Pöstinger</dc:creator>
    <dc:date>2007-08-22T04:41:13Z</dc:date>
    <item>
      <title>grep and |</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058272#M94455</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;I need some help with the grep-Command in combination with the logical OR '|'. The following expression does not work correctly. It should recognize all correct dates in the form MMYYYY between 012000 and 122019.&lt;BR /&gt;&lt;BR /&gt;grep "^\(1[0-2]\)\|\(0[1-9]\)20[0-1][0-9]$"&lt;BR /&gt;&lt;BR /&gt;The problem is definitely the |. I tried it with or without the \, but it does not make any difference. I am using it in a script. The corresponding lines are&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;[.........]&lt;BR /&gt;grepErg=`echo $datum | grep "^\(1[0-2]\)\|\(0[1-9]\)20[0-1][0-9]$"`&lt;BR /&gt;&lt;BR /&gt;Hope you can help me.&lt;BR /&gt;&lt;BR /&gt;Greetings,&lt;BR /&gt;  Markus</description>
      <pubDate>Wed, 22 Aug 2007 03:45:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058272#M94455</guid>
      <dc:creator>Markus Pöstinger</dc:creator>
      <dc:date>2007-08-22T03:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: grep and |</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058273#M94456</link>
      <description>grep doesn't take a "|", only egrep.&lt;BR /&gt;I recommend you not use grep -E if you can use grep -e xxx -e yyy.&lt;BR /&gt;But since you are using tricky "()", you need -E.&lt;BR /&gt;I got your query to work with this pattern:&lt;BR /&gt;grep -E "^(1[0-2])|(0[1-9])20[0-1][0-9]$"</description>
      <pubDate>Wed, 22 Aug 2007 04:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058273#M94456</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-22T04:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: grep and |</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058274#M94457</link>
      <description>Thank you very much. :)</description>
      <pubDate>Wed, 22 Aug 2007 04:41:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-and/m-p/4058274#M94457</guid>
      <dc:creator>Markus Pöstinger</dc:creator>
      <dc:date>2007-08-22T04:41:13Z</dc:date>
    </item>
  </channel>
</rss>

