"
Help me to split the data for IP separately store to request method separately store a file to a file request page separately store status code to a file storage to store a file name of the user's browser to a file
Help me how many IP output different IP how many
Help me GET request output how many times how many times a POST request method
Help me to output a status code of 200 have? How many a
Help me to statistics which browser users use ~ most times
CodePudding user response:
Treated with awk baiAwk '{print $1}' log print with a space in the log file for the first field separator, to paraphrase, you can also add -f option awk -f ":" '{print $2}' promise to colon delimiter second field
As for the statistics, you can use the awk, also can use grep, uniq, such as sort and uniq to heavy, uniq -c to heavy, repeat the number of rows, and statistics figures will write in the back; The sort order
Such as IP output to IP. TXT cat IP. TXT | wc -l statistics how many IP; The cat IP. TXT | sort | uniq - d what are the different IP; The cat IP. TXT | sort | uniq -c statistics how many each IP
Baidu up how to do
CodePudding user response:
Such as take IPThe awk - F "} "' {print $1} 'log | awk -f" {"' {print $2} '& gt; IP. TXT first take}, for the first part of the separator, namely IP {110.167.95.97, then take to {separator part 2, the world is IP 110.167.95.97