title: specific text of today's date from txt file by powershell
body: <p>I have a text file. Similar to this.</p>
  
  <pre><code>This is a sample data.
  This is a sample data.
  This is a sample data.
  Sat Jun 06 08:17:01 2015
  WARNING: Cannot delete file.
  Error-101
  Error-100
  Error-102
  This is a sample data.
  This is a sample data.
  Error-10666
  This is a sample data.
  Sat Jun 06 10:17:01 2015
  File deleted.
  This is a sample data.
  This is a sample data.
  Sat Jun 06 10:17:01 2015
  File deleted.
  Sat Jun 06 11:17:01 2015
  WARNING: Cannot delete file.
  Error-101
  This is a sample data.
  Sat Jun 06 18:17:01 2015
  WARNING: Cannot delete file.
  Error-101
  This is a sample data.
  </code></pre>
  
  <p>This file contain one month data.
  There could be multiple files like this in a directory. Script will need to check the file that modified today.</p>
  
  <p>I want to get the <strong>Error-???</strong> (Entire line of Error-) value of today's date.
  So far i have created this.</p>
  
  <pre><code>$cur_date1 = get-date -UFormat %c
  $curdate = (get-date).ToString("ddMMyyyy")
  ForEach ($system in (Get-Content D:\Script\system.txt)) {
          $dir = "\\$system\D$\Error\"
          $latest = Get-ChildItem -Path $dir -Filter error*.txt | where{$_.LastWriteTime.ToString("ddMMyyyy") -eq $date }
  
  $files=$latest.name
  Foreach($file in $files){
           $path= $dir+$file 
  
          $search =  Get-Content $path 
  
      $a = $search| if($_ -eq $curdate){
  
      Where-Object{$_.Contains("Error-") }
  
  
      }
  
        }
  
  }
  </code></pre>
  
  <p>I can check the files created today.
  I can get content of entire file.
  I can search the error- string but i am not able to search for current date.</p>
  
  <p>Can anybody advise me on this?</p>
  
  <p>Thanks.</p>
  
  <p>If any changes need to be done in title or discription then please do so.
  Thanks for your time.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Just to inform you my system datetime format is as follows.
  <strong>dd/mm/yyyy hh:mm:ss</strong></p>