天道酬勤,学无止境

手札

awk和sed截取nginx和tomcat时间段日志

nginx日志截取示例 日志路径:/usr/local/nginx/logs, 截取access.log中2019年3月24日17点00~02之间的日志: 写法1: cat access.log | awk '$4 >="[24/Mar/2019:17:00:00" && $4 <="[24/Mar/2019:17:02:00"'  写法2: cat access.log | egrep "24/Mar/2019" | awk -F':' '$2 = 17 && $3 >= 00 && $3 <= 02'  写法3: cat access.log |egrep "24/Mar/2019" |sed -n '/17:00:00/,/17:02:00/p' tomcat日志截取示例 日志路径:/usr/local/tomcat/logs, 截取catalina.out中2019年3月24日17点00~02之间的日志:写法1: sed -n '/2019-03-24 17:00:/,/2019-03-24 17:02:/p' catalina.out 写法2: cat catalina.out| egrep "2019-03-24" | awk -F':' '$2 = 17 && $3 >= 00 && $3 <= 02' awk统计nginx日志的ip访问量

2021-05-12 13:29:37    分类:博客    sed   awk   手札

pip安装使用出现ImportError: No module named setuptools

安装后运行到:python setup.py install出现错误,如下: [root@localhost pip-18.0]# python setup.py install Traceback (most recent call last): File “setup.py”, line 6, in from setuptools import setup, find_packages ImportError: No module named setuptools 解决方法 1.下载: 在它的官网可以下载到安装包: https://pypi.python.org/pypi/setuptools 下载路径: #wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65 2. 安装 # tar xvf setuptools-12.0.3.tar.gz # cd setuptools=12.0.3 # python setup.py install # cd pip-18.0 # python setup.py install来源:https://blog

2021-03-27 08:43:29    分类:博客    pip   python   No    手札