set line = xxx/yyy/xxx/xxxxxxxx.h:32:#include "../../xxxx/xxxxx.h"
if this is the string, how can i extract just xxxxxxxx.h, between / and : in batch script?
i have included the bin path of cygwin to my windows environment variables so it can run grep commands. Current, this is my script:
@echo off
SETLOCAL enabledelayedexpansion
set /p search_parameter="Type your search: "
rem run grep seach commmand
grep -nri %search_parameter% --colour --include=*.{c,h} > text.txt
rem filter required lines into new text file
type text.txt | findstr /I "#include" | findstr /V "examples DELIVERY_REL" > text2.txt
rem read text file line-by-line
for /F "tokens=* delims=" %%G in (text2.txt) do (
set "line=%%G"
rem echo line: !line!
for /f "delims=:" %%i in ("!line!") do set "line=%%i"
for %%i in (!line:/= !) do set "line=%%i"
echo line: !line!
)
pause
echo on
Currently, this is my output:
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
line: line:/
The problem is this line:
for %%i in (!line:/= !) do set "line=%%i"