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 .
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.
yourcommandgivingsoneoutput | find "yourword"
Commented
Jan 20, 2016 at 1:53
actually, you didn't get the concept because in fact you want to search in a " program" while you can search in "files" ...
CMD, git-bash or any other terminal is not a file like a text file or word document or any other type of files so searching in terminals has no meaning as it's nonsense if you want to search in "clash of clans" !!
but you can search in the output of any command and there are many ways for this, for Example, we can search in the output of dir
command:
1- #>dir | find "search_word"
→ will find any output which is Exactly like your search_word
2- #>dir *search_word*
→ will find any output that contain your search_word