该文件包含如下行:
1363650803.076 48 192.168.20.58 TCP_MISS/417 1963 POST http://collector-4.newrelic.com/agent_listener/invoke_raw_method? - NONE/- text/html
1363650863.426 0 192.168.20.58 TCP_MISS/417 1963 POST http://collector-4.newrelic.com/agent_listener/invoke_raw_method? - NONE/- text/html
1363650898.698 63995 192.168.20.61 TCP_MISS/000 0 GET http://65.55.122.235/2.0/blugro5relay.groove.microsoft.com/p9xyqk93z98qti59r7taftbcxe3s6rt52n4drjs,ConnType=LongLived,ContentLength=2147479552 - DIRECT/65.55.122.235 -
1363650898.698 63995 192.168.20.61 TCP_MISS/000 0 POST http://65.55.122.235/2.0/blugro5relay.groove.microsoft.com/p9xyqk93z98qti59r7taftbcxe3s6rt52n4drjs,ConnType=LongLived - DIRECT/65.55.122.235 -
1363650899.199 63991 192.168.20.61 TCP_MISS/000 0 GET http://65.55.122.235/2.0/blugro5relay.groove.microsoft.com/xatanmtq99upj97qtps89zqnx99wqsyeuc5yefa,ConnType=KeepAlive - DIRECT/65.55.122.235 -
1363650899.199 63991 192.168.20.61 TCP_MISS/000 0 POST http://65.55.122.235/2.0/blugro5relay.groove.microsoft.com/xatanmtq99upj97qtps89zqnx99wqsyeuc5yefa,ConnType=KeepAlive - DIRECT/65.55.122.235 -
我想从每一行中获取主机名/IP 地址。
这个 sed 命令有什么问题?
sed -rn "s@//([^/]+)/@\1@" access.log