ZhangZhihui's Blog  

diyuser3@training1:~/qs-class/roar-k8s$ grep -n5 "NodePort" roar-complete.yaml
25- name: roar-web
26- labels:
27- name: roar-web
28- namespace: roar
29-spec:
30: type: NodePort
31- ports:
32- - port: 8089
33- targetPort: 8080
34- nodePort: 31789
35- selector:

-n, --line-number
Print lines and their line numbers.

 

diyuser3@training1:~/qs-class$ kubectl logs -n roar2 roar-web-74bb47bdb8-lgwhv | grep -m1 -B3 failure
INFO: Server startup in 5540 ms
Nov 21, 2019 8:38:13 AM com.demo.dao.MyDataSource getMySQLDataSource
INFO: Attempting to use jdbc:mysql://localhost:3306/registry
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

 

-m num, --max-count=num
Stop looking after num matches are found.

-B num, --before-context=num
Print num lines of text that occur before the matching line.

 

Print 2 lines after the matching line:

dig300au:/home/scnzzh/dig/myedp/conf $> grep -A 2 thread myedp_ecw_dbloads_sked.xml
<entry type="thread" name="PARALLEL_THREAD">
<depend>NONE</depend>
</entry>

posted on 2019-11-19 16:24  ZhangZhihuiAAA  阅读(126)  评论(0编辑  收藏  举报