开发者

Extract data between two points in a text file

Ho开发者_开发问答w would it be possible to extract data between two points in a text file?

E.g.

Reply: [200/OK] bytes=29086 time=583ms

The value between "time=" and "ms"


sed -n 's/.*time=\(.*\)ms/\1/p' < logfile

This sets up a regular expression that captures everything between the time= and ms into the first capture group (which is referred to on the right-hand-side as \1) and prints it.


cut -d= -f3 filename | grep -o '^[0-9]\+'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜