title: Ignore grep -v not query when empty pattern is passed?
body: <p>I have a piece of code which is working as it should be but i want a different result. Let's say <code>$query_value</code> and <code>$not_query_value</code> is <code>empty</code>. </p>
  
  <pre><code>`sed -n "$dateRange" $error_log_file_name|egrep -i "($query_value)"|grep -E -i -v "($not_query_value)"|head -n $first_few_lines_value&gt;&gt;$extracted_log_path_value` 
  </code></pre>
  
  <p>The output from <code>sed</code> is passed to grep. <code>grep</code> returns everything and <code>grep -V</code> returns nothing when empty pattern is passed. My desire is that <code>grep -V</code> should act like <code>grep</code> when <code>empty</code> patter is passed to it. I could achieve it by <code>if,else</code> conditions by checking whether empty pattern is not passed to grep -V. But i don't want to provide any checkpoint. Is there a way <code>grep -V</code> could be ignored when <code>$not_query_value</code> is not provided ?</p>
  
  <p>An input sample is -  </p>
  
  <pre><code>sed -n '/2018-02-19 00:0[0-9]/,/2018-02-19 23:59/p' "/var/opt/MarkLogic/Logs/ErrorLog_2.txt"|egrep -i "()"|grep -E -i -v "()"|head -n $first_few_lines_value&gt;&gt;$extracted_log_path_value;
  </code></pre>
  
  <p>which returns nothing. The expected output would be huge lines of log files like -  </p>
  
  <pre><code>&gt; 2018-02-19 00:01:03.668 Info: Merged 26 MB in 1 sec at 19 MB/sec to
  &gt; /var/opt//Forests/Meters/000059de 2018-02-19 00:01:06.046 Info:
  &gt; Deleted 20 MB at 7321 MB/sec /var/opt//Forests/Meters/000059db
  &gt; 2018-02-19 00:01:06.050 Info: Deleted 6 MB at 1546 MB/sec
  &gt; /var/opt//Forests/Meters/000059da 2018-02-19 00:01:06.054 Info:
  &gt; Deleted 7 MB at 1988 MB/sec /var/opt//Forests/Meters/000059dc
  &gt; 2018-02-19 00:10:00.406 Info: Saving /var/opt//Forests/Meters/000059dd
  &gt; 2018-02-19 00:10:01.059 Info: Saved 6 MB in 1 sec at 9 MB/sec to
  &gt; /var/opt//Forests/Meters/000059dd 2018-02-19 00:17:01.076 Info: Saving
  &gt; /var/opt//Forests/Meters/000059df 2018-02-19 00:17:01.349 Info: Saved
  &gt; 6 MB at 22 MB/sec to /var/opt//Forests/Meters/000059df 2018-02-19
  &gt; 00:17:01.375 Info: Merging 30 MB from
  &gt; /var/opt//Forests/Meters/000059de, /var/opt//Forests/Meters/000059dd,
  &gt; and /var/opt//Forests/Meters/000059df to
  &gt; /var/opt//Forests/Meters/000059e1, timestamp=15190204210766740
  &gt; 2018-02-19 00:17:04.285 Info: Merged 29 MB in 3 sec at 10 MB/sec to
  &gt; /var/opt//Forests/Meters/000059e1 2018-02-19 00:17:07.209 Info:
  &gt; Deleted 26 MB at 922 MB/sec /var/opt//Forests/Meters/000059de
  &gt; 2018-02-19 00:17:07.239 Info: Deleted 6 MB at 198 MB/sec
  &gt; /var/opt//Forests/Meters/000059dd 2018-02-19 00:17:07.251 Info:
  &gt; Deleted 6 MB at 516 MB/sec /var/opt//Forests/Meters/000059df
  &gt; 2018-02-19 00:19:01.558 Info: Merging 1 MB from
  &gt; /var/opt//Forests/App-Services/00000a33 to
  &gt; /var/opt//Forests/App-Services/00000a35, timestamp=15190205407316140
  &gt; 2018-02-19 00:19:01.626 Info: Merged 2 MB at 29 MB/sec to
  &gt; /var/opt//Forests/App-Services/00000a35 
  </code></pre>
  
  <p>which comes as expected till grep command but <code>grep -V {empty pattern}</code> reverses and returns nothing. I want something like when empty pattern is passed in <code>grep -V</code> it should be either not executed or act like grep (as grep returns everything in case of empty sequence).</p>