apache - Convert bash line to use in perl -
How do I go about changing the following bash line to Pearl? Can I run the system () command, or better way? I'm looking to print out my Appreciate access_log file every day.
In the Bash:
awk '{print $ 4}' / etc / httpd / log / access_log | Cut-D: -f1 | Uniq -c
prints the following:
632 [27 / April / 2014 156 [28 Apr / 2014
awk '{print $ 4}' / etc / httpd / logs / access_log | Cut-D: -f1 | UniC-C
perl -lane '($ val) = partition /: /, $ F [3]; #The first element of the fourth column # + $ c {$ val} is the element separated by colon; # Increasing the number of frequencies {Print to map {"$ c {$ _} $ _"} keys% c} # 'Do not use print' in any order access.log
Switch:
-
-l
automatically adds a new line to the print statement. New lines from -
-l
are also deleted; the line read by-n
(and-p
). -
-a
divides the row into an array on the green space@f
. -
-n
lines on the lines of the input, but do not print each line.
Comments
Post a Comment