How retrieve all the text between "" among many lines with findstr?
For example i have:
Line1
Line2
Line3
"Line 4
Line 5
Line 6
"
Line 7
Line 8
and i need to return
Line 4
Line 5
Line 6
How retrieve all the text between "" among many lines with findstr?
For example i have:
Line1
Line2
Line3
"Line 4
Line 5
Line 6
"
Line 7
Line 8
and i need to return
Line 4
Line 5
Line 6
Working with your sample data... This is as good as I can get without too much effort in rigidity.
'file'txt' contains your data...
@echo off
setlocal enabledelayedexpansion
set quote=
for /f "tokens=*" %%a in (file.txt) do (
set str=%%a
set str=!str:"=:!
if not "!str!"=="!str::=!" (
if defined quote (
set quote=
for %%b in (^"%%a) do set str=%%~b
if not "!str!"=="" if not "!str: =!"=="" echo !str!
) else (
set quote=1
for %%b in (%%a^") do set str=%%~b
)
)
if defined quote (
if not "!str!"=="" if not "!str: =!"=="" echo !str!
)
)