I
I
Ivan Melnikov2019-06-18 07:43:43
cmd/bat
Ivan Melnikov, 2019-06-18 07:43:43

How can findstr return not a whole string, but a substring that satisfies the regular expression?

Team

findstr /R ".-.-.-..-..........-..........-..........-...." temp.txt

returns a string with spaces and a newline character at the end, but you need a string like
".-.-.-..-..........-..........-... .......-...."
without unnecessary garbage.
How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
res2001, 2019-06-18
@res2001

You need to put the output of findstr into for /f and there already cut, divide into parts, etc. above each line.
Schematically like this:

for /f "tokens=*" %%a in ('findstr /R ...') do (
  echo.%%a
)

For reference:for /?

A
AUser0, 2019-06-18
@AUser0

I can recommend GnuWin32, a set of utilities from a UNIX-like system, but under Windows.
There, in particular, there is grep, it will give the required piece from the line ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question