S
S
sflyer2019-09-09 08:35:18
cmd/bat
sflyer, 2019-09-09 08:35:18

Findstr and substring in cmd or how to get part of string?

There is a command that produces information in the format:

cluster :  1234asdf-a12f-451d-a1b1-0123456abc78
host : hostname

Etc.
You only need to get the cluster value.
rac.exe cluster list | findstr "cluster"
It prints out the whole line, along with cluster: , and I don't need this part. But applying substring to findstr is not possible.
In linux, there is cut or awk (which is the best option, for me), is it possible to do the same with the output of the software in cmd?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2019-09-09
@sflyer

how to get part of a string?
SET
FOR /f "tokens=1" %%i IN ('rac.exe cluster list | findstr "cluster"') DO
and process %%ifurther.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question