AWK指定多个空格作为分隔符
在查看nginx日志里被get的目录时,使用AWK命令指定多个分隔符可以解决问题,命令如下: awk -F'(GET )|[ ]+' '{print $7}' /var/log/nginx/access.log | sort -nr | uniq -c | sort -n | tail 对应的示例输出结果如下, 530 /wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1 544 /wp-content/plugins/sidebar-login/assets/css/sidebar-login.css?ver=2.7.3 595 /wp-content/themes/boston/assets/fonts/Norwester-Regular.ttf 850 /wp-content/themes/boston/assets/fonts/Norwester-Regular.woff 917 /robots.txt 3851 /wp-admin/admin-ajax.php 4632 /xmlrpc.php 4990 / 27450 /wp-login.php 37397 /wp-includes/js/wp-emoji-release.min.js?ver=4.6.1