The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-29-2008
openspark openspark is offline
Registered User
  
 

Join Date: Aug 2008
Location: New Jersey
Posts: 22
Smile Perl Search pattern error

Hi,

  1. I am trying to grep for two patterns from a set of 820 apache webserver logs,
  2. When I Try to search the pattern with a date stamp and use a wildcard character * for ex: /28/Aug/2008:21*/ to get all the log entries for that particular hour that is 21 st hour I get errors. Please kindly let me know where I am going wrong.

The following is the command I am trying to use:

perl -ne 'print if (/mckinskey@futuron.com/ ? ($c=1) : (--$c > 0)) ; print if (/28/Aug/2008:21*/ ? ($d = 1) : (--$d > 0))' request.log*



[m78i5@serv125 ~]$ perl -ne 'print if (/mckinskey@futuron.com/ ? ($c=1) : (--$c > 0)) ; print if (/28/Aug/2008:01:35*/ ? ($d = 1) : (--$d > 0))' request.log*
Bareword found where operator expected at -e line 1, near "/28/Aug"
(Missing operator before Aug?)
syntax error at -e line 1, near "/28/Aug"
Search pattern not terminated at -e line 1.

[m78i5@serv125 ~]$ perl -ne 'print if (/mckinskey@futuron.com/ ? ($c=1) : (--$c > 0)) ; print if (/28/Aug/2008:01*/ ? ($d = 1) : (--$d > 0))' request.log*
Bareword found where operator expected at -e line 1, near "/28/Aug"
(Missing operator before Aug?)
syntax error at -e line 1, near "/28/Aug"
Search pattern not terminated at -e line 1.

[m78i5@serv125 ~]$ perl -ne 'print if (/mckinskey@futuron.com/ ? ($c=1) : (--$c > 0)) ; print if (/28/Aug/2008:21*/ ? ($d = 1) : (--$d > 0))' request.log*
Bareword found where operator expected at -e line 1, near "/28/Aug"
(Missing operator before Aug?)
syntax error at -e line 1, near "/28/Aug"
Search pattern not terminated at -e line 1.



Thanks

Last edited by openspark; 08-29-2008 at 11:54 AM.. Reason: Had to change a character and add additional information,