1, the number of IP direct output display:
cat access_log_2011_06_26.log |awk ‘{print $1}‘|uniq -c|wc -l
2, the number of IP output to the text display:
cat access_log_2011_06_26.log |awk ‘{print $1}‘|uniq -c|wc -l > ip.txt
Summary: If a single access log is larger than 2G, the system load will rise when viewed with this command, so do not view when the server is under high load, preferably in a low load time period. The above is one of the company's advertising server a day of IP access, which actually includes the search engine. Access logs can only be a reference, to be accurate or to be counted by the program.
Cat Access_log_2011_06_26.log |awk ' {print $} ' can be changed to
awk ' {print '} ' Access_log_2011_06_26.log
This saves resources and is faster
(summary) A shell that counts the number of independent IP accesses in Apache or Nginx access logs