There is a text file with an unknown number of rows like this:
$ cat test1
123
abc
456
def
...
def
123
456
def
abc
456
123
Using the windows console tools it's necessary to determine the number of rows '123'.
There is a text file with an unknown number of rows like this:
$ cat test1
123
abc
456
def
...
def
123
456
def
abc
456
123
Using the windows console tools it's necessary to determine the number of rows '123'.
If it is the complete content of the line
findstr "^123$" test.txt |find /C "123"
If you want the result be put in a var on the cmdline
For /f %A in ('findstr "^123$" test.txt ^|find /C "123"') Do set Var=%A
If you want the result be put in a var inside a batch
For /f %%A in ('findstr "^123$" test.txt ^|find /C "123"') Do set Var=%%A