Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find a word in CMD command output

i'm trying to find a word in a CMD command output (like using ctrl+f in a file) the output contains a lot of lines ...

Any hints ? thanks .

like image 565
The Beast Avatar asked Oct 23 '25 02:10

The Beast


1 Answers

find "yourword" filename

to show your word in any line of a file.

yourcommandgivingsoneoutput | find "yourword"

to examine the output of some command for your word.

If you just want to see whether your word ixists in the data, then append >nul to the line to suppress output and on the next line of (presumably) your batch use

if errorlevel 1 (echo word missing) else (echo word found)

There are many options which you can invoke - use

find /?

from the prompt for documentation.

findstr is similar, and allows searching for multiple words and has a restricted regex implementation.

findstr /?

from the prompt for documentation.

like image 101
Magoo Avatar answered Oct 25 '25 16:10

Magoo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!