linux工具——grep介绍

152 阅读1分钟
  1. 使用grep正则表达式提取想要的字符串部分,而不是整体输出
#!/bin/sh
cat xxx.log|grep request_in |grep uri_segment |grep -o '"app_id":"[0-9]*"'
  1. grep -n 输出行号
#!/bin/sh
cat xxx.log|grep request_in |grep uri_segment |grep -no '"app_id":"[0-9]*"'