grep 은 -C 로 내가 찾고 싶은 단어 위아래로 검색 하게 해주는데 windows 에서도 찾아봤는데 findstr 로는 안되고 powershell 명령어인 Select-String 으로 되는 것을 확인
Yaml 형태의 문법인 경우 유용하게 사용 가능하다.
PS C:\Users\nzin4> kubectl describe po flask3 | Select-String -Pattern 'Label' -Context 2,3
Node: minikube/192.168.49.2
Start Time: Wed, 07 Jul 2021 15:41:04 +0900
> Labels: app=test
run=flask3
Annotations: <none>
Status: Running
긴 결과에 대해서 Select-String 으로 pipe 로 넘긴 후 -Pattern 인자로 검색 -context 로 검색 되었다면 그 위의 2줄, 아래로는 3줄을 보여라 라는 명령을 호출하면 된다.
PS C:\Users\nzin4> kubectl describe po flask3 |Select-String -Pattern 'Label' -Context 2,3
Node: minikube/192.168.49.2
Start Time: Wed, 07 Jul 2021 15:41:04 +0900
> Labels: app=test
run=flask3
Annotations: <none>
Status: Running
뭔가 내가 지정한 것보다 하나 더 많이 검색 하는 것 같다.