This is an old revision of the document!
Table of Contents
findstr a grep alternative for Windows
Mar 2025
Introduction
In Linux, you can filter the return from a command using grep, so if you typed in something that produces pages of responses, like lspci, you can then search using grep.
For example. In linux, using Kubernetes I can issue the following command:
kubectl -n mediakind get pods
The response will be:
NAME READY STATUS RESTARTS AGE encoding-live-ui-connector-7fd56f5f49-nm8xw 1/1 Running 2 (76d ago) 76d internal-pois-resiliency-54b7457b4b-mk8qh 1/1 Running 2 (76d ago) 76d automation-proxy-primary-d59bd7d59-p2x4r 1/1 Running 2 (76d ago) 76d stream-processor-simulcrypt-779bd9c84d-qjghj 1/1 Running 1 (76d ago) 76d stream-processor-statmux-668475d9d8-n2b24 1/1 Running 1 (76d ago) 76d encoding-live-config-d8d46bcc-s4pzf 1/1 Running 2 (76d ago) 76d stream-processor-mux-68985b79cf-b8m8r 2/2 Running 2 (76d ago) 76d mongo-operator-5876548666-2nx6v 1/1 Running 2 (76d ago) 76d command-77d97549b6-gl5wv 1/1 Running 2 (76d ago) 76d statistic-7f86d854dc-jx4c9 1/1 Running 2 (76d ago) 76d kps-agent-operator-7ffc49bb56-bccz8 1/1 Running 2 (76d ago) 76d stream-processor-asi-7d8b68d7b7-xbh92 1/1 Running 1 (76d ago) 76d controller-metrics-exporter-55445c799b-cfhr7 1/1 Running 2 (76d ago) 76d srt-worker-launcher-dcf66587-vg288 1/1 Running 1 (76d ago) 76d ipmi-exporter-5b9bbcf8bd-r7868 1/1 Running 2 (76d ago) 76d aquila-crpm-tools-5d9cf76b-28g5h 1/1 Running 1 (76d ago) 76d automation-proxy-secondary-768fd9bc48-ldf9j 1/1 Running 2 (76d ago) 76d stream-processor-ui-connector-847c9dcf6b-4js4p 1/1 Running 1 (76d ago) 76d stream-processor-biss-ca-5b65ff775b-wd5g2 1/1 Running 1 (76d ago) 76d live-sources-config-6f484978bb-9t66m 1/1 Running 2 (76d ago) 76d alarm-legacy-56785c8649-7592l 2/2 Running 4 (76d ago) 76d kps-prometheus-node-exporter-msvzd 1/1 Running 2 (76d ago) 76d fluent-bit-6f974c7f5b-mk9k2 1/1 Running 2 (76d ago) 76d api-gateway-559fc7bd7d-nlxbn 2/2 Running 2 (76d ago) 76d encoding-live-worker-54cccbb-tbptk 1/1 Running 2 (76d ago) 76d alertmanager-kps-alertmanager-0 2/2 Running 4 (76d ago) 76d alarm-5d8898c89c-khzs8 3/3 Running 6 (76d ago) 76d template-api-7486b595d8-cn55x 1/1 Running 2 (76d ago) 76d server-monitor-66869c694-c2wwj 1/1 Running 1 (76d ago) 76d server-daemon-6bffcf8df5-282kc 1/1 Running 2 (76d ago) 76d etcd-controller1-0 1/1 Running 2 (76d ago) 76d mongodb-replicaset-controller1-0 2/2 Running 4 (76d ago) 76d redis-67b9f55655-645zm 1/1 Running 2 (76d ago) 76d metrics-grafana-5ff6669d44-2gwlr 3/3 Running 6 (76d ago) 76d prom-agent-kps-agent-prometheus-0 2/2 Running 4 (76d ago) 76d kps-kube-state-metrics-55497f5b9f-4dwqp 1/1 Running 2 (76d ago) 76d stream-processor-content-extraction-5ffc9cc565-s7hlw 1/1 Running 2 (76d ago) 76d server-api-7795b4f985-bm8d8 1/1 Running 2 (76d ago) 76d packaging-vod-ui-connector-5df89f46bb-pdv7m 1/1 Running 1 (76d ago) 76d packaging-cleanup-agent-6d74fcf646-dmscp 1/1 Running 1 (76d ago) 76d packaging-recorder-ui-connector-5668f86b-q5gd9 1/1 Running 1 (76d ago) 76d packaging-dvr-auto-669bd74d86-wzvsp 1/1 Running 1 (76d ago) 76d support-package-55f7645d79-q4gpq 2/2 Running 4 (76d ago) 76d packaging-asset-recorder-94884c846-ncmjx 2/2 Running 2 (76d ago) 76d rabbitmq-ha-controller1-0 1/1 Running 2 (76d ago) 76d alarm-adapter-85bc8bcd66-xpc9b 1/1 Running 2 (76d ago) 76d prometheus-kps-prometheus-0 2/2 Running 4 (76d ago) 76d snmp-notification-96948bc45-gdlkm 1/1 Running 2 (76d ago) 76d packaging-dynamic-ui-connector-b64986898-c9jn6 1/1 Running 1 (76d ago) 76d unified-ui-c7554fb59-xc8g9 3/3 Running 6 (76d ago) 76d packaging-config-d644cf946-gwf6h 1/1 Running 1 (76d ago) 76d srt-config-5784dd8f46-2twbd 1/1 Running 1 (76d ago) 76d alarm-proxy-54fdfbcf6b-28r28 1/1 Running 2 (76d ago) 76d stream-processor-config-766fdb8c96-nb2nl 1/1 Running 1 (76d ago) 76d esam-proxy-56d6d4689d-9gp5j 1/1 Running 2 (76d ago) 76d service-api-dbc74c6fc-s9wln 2/2 Running 4 (76d ago) 76d flow-5797b66959-82qms 1/1 Running 2 (76d ago) 76d interface-discovery-99d6bcff9-2gsgl 1/1 Running 2 (76d ago) 76d srt-ui-connector-6f6bdbd4c9-f2qtd 1/1 Running 1 (76d ago) 76d packaging-dvr-recorder-7b65cf774b-tx972 3/3 Running 3 (76d ago) 76d failover-api-745685c8d7-5872v 3/3 Running 6 (76d ago) 76d packaging-origin-server-64b75c54ff-pd4wh 7/7 Running 7 (76d ago) 76d license-manager-0 2/2 Running 5 (76d ago) 76d
However, If I was only interested in say 'srt' I could use grep to filter the response.
kubectl -n mediakind get pods |grep srt
This would return just any lines that contain 'srt'
srt-worker-launcher-dcf66587-vg288 1/1 Running 1 (76d ago) 76d srt-config-5784dd8f46-2twbd 1/1 Running 1 (76d ago) 76d srt-ui-connector-6f6bdbd4c9-f2qtd 1/1 Running 1 (76d ago) 76d
So grep is a fantastic tool for this, however, grep is not in Windows.
findstr
What is in Windows (and I am using Windows 11-21H2, which is quite old) is something called 'findstr'. The syntax for findstr is very similar. Please bear in mind that grep may do more things that findstr, I am just using this one use case of filtering results from issued commands.
kubectl -n medikind get pods | findstr srt
srt-fe7a53f67-srt-worker-launcher-54796fb846-r8mpz 2/2 Running 0 58m srt-mux-vvltle-main-egress-srt-mux-vvltle-main-6756b5b7d-z52ng 2/2 Running 0 22m srt-mux-vvltle-main-srt-worker-launcher-68bfccb69c-94vsq 2/2 Running 0 23m
So findstr works very well in this use case.
