
sed,awk
bobtthp
云原生爱好者
展开
-
sed,awk多条件匹配
Oct 24 12:00:01 bob systemd: Started Session 49 of user root. Oct 24 12:00:01 bob systemd: Starting Session 49 of user root. Oct 24 12:01:02 bob systemd: Started Session 50 of user root. Oct原创 2017-10-24 12:29:06 · 2918 阅读 · 0 评论 -
sed、awk截取日志
awk ‘/字符串1/{a=1}a{b=b?b"\n"$0:$0;if(b~/字符串2/){print b;b=""}}’ file sed -n ‘/字符串1/{p;:1;n;:2;/字符串2/{p;b1};N;b2}’ file awk ‘/字符串1/{a=1}a{b=b?b"\n"$0:$0;if(b~/字符串2/){print b;b=""}}’ file sed -n ‘/字符串1...原创 2018-09-22 19:12:46 · 1979 阅读 · 0 评论