- 论坛徽章:
- 0
|
回复 15# blackold
不会吧?第一个s命令中的pattern可以替换成任何内容啊,比如:
- $>cat a
- PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
- 64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.045 ms
- --- 127.0.0.1 ping statistics ---
- 1 packets transmitted, 1 received, 0% packet loss, time 0ms
- rtt min/avg/max/mdev = 0.045/0.045/0.045/0.000 ms
- $>sed -r 's/([0-9.])+/&\x00&\n/g;:1;s/(\x00k*)[^\nk]/\1k/;t1;s/\n//g' a
- PING 127.0.0.1kkkkkkkkk (127.0.0.1kkkkkkkkk) 56kk(84kk) bytes of data.k
- 64kk bytes from 127.0.0.1kkkkkkkkk: icmp_req=1k ttl=64kk time=0.045kkkkk ms
- --- 127.0.0.1kkkkkkkkk ping statistics ---
- 1k packets transmitted, 1k received, 0k% packet loss, time 0kms
- rtt min/avg/max/mdev = 0.045kkkkk/0.045kkkkk/0.045kkkkk/0.000kkkkk ms
复制代码 |
|