从grep输出中删除标签
问题描述:
我有一个命令,查找IP地址在特定日期的位置。它看起来像这样:从grep输出中删除标签
zcat /nsm/bro/logs/[DATE]/http_eth1.* | bro-cut -D“%G-%m-%d%R:%S”ts id.orig_h host uri | grep [IP_Address]
除了一件事以外,它工作得很好。输出看起来像这样:
2013年1月16日23时38分26秒[IP地址] safebrowsing-cache.google.com /安全浏览/ RD/ChFnb29nLXBoaXNoLXNoYXZhchAAGIX_DyCY_w8yB4X_AwD__w8
有“安全浏览高速缓存之间的突片。 google.com“和”/ safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchAAGIX_DyCY_w8yB4X_AwD__w8“。我想只删除该特定标签。有没有办法可以做到这一点?
答
使用awk
实施例:echo -n 'first\tsecond\tthird\tfourth\n' | awk '{ print $1"\t"$2"\t"$3$4 }'
输出first\tsecond\tthirdfourth
- “第三” 和 “第四” 之间的标签已被删除。
谢谢,解决了它 – user1991682