2018-07-12 19:35:14 +0800 Lauren C.:
> Hello,
> 
> My web is powered by Apache and PHP,its access log seems as blow,
> 
> xx.xx.xx.xx - - [12/Jul/2018:19:29:43 +0800] "GET
> /2018/07/06/antique-internet/ HTTP/1.1" 200 5489 "https://miscnote.net/";
> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML,
> like Gecko) Chrome/67.0.3396.99 Safari/537.36"
> 
> A perl script for stat purpose of this log:
> 
> tail -f /var/log/apache2/access.log|perl -nle 'next unless m{^(\S+) - -
> \[(\S+).*\] \"GET (.*?/)\s+}; printf "%-20s%-40s%-40s\n",$1,$3,$2'
> 
> I was totally confused about it.
>  what does m{...} and its content stand for?
> Can you help give a explain?

Hi, Lauren

The m{...} is a regular expression (regexp). If you not familiar with
regexps in Perl, I advise you to read these pages:

- http://perldoc.perl.org/perlintro.html#Regular-expressions
- http://perldoc.perl.org/perlrequick.html

> thanks in advance.
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
> 
> 

Attachment: signature.asc
Description: Digital signature

Reply via email to