M
Matt Williamson
Given the following script
setlocal enabledelayedexpansion
if exist file.txt (
for /f "tokens=*" %%a in ('type file.txt^|find "BOF"') do (set dt=%%a)
set dt=!dt: = !&set dt=!dt: = !&set dt=!dt: = !
for /f "tokens=7" %%a in ('echo !dt!') do set dt=%%a
echo !dt!
)
Where after the 3rd line the dt variable contains:
BOF PING GLOBAL ACTIVITY DATA OF 12/13/2006 TO REMOTE 123 BEGINS
HERE 12/13/2006 23:13:38
Is there a better way to extract the Date after DATA OF? Right now, I'm
replacing 2 spaces with 1 space multiple times so I can use the second for
loop to reliably extract the date. I'm just wondering what other ways there
are to do it.
TIA
Matt
setlocal enabledelayedexpansion
if exist file.txt (
for /f "tokens=*" %%a in ('type file.txt^|find "BOF"') do (set dt=%%a)
set dt=!dt: = !&set dt=!dt: = !&set dt=!dt: = !
for /f "tokens=7" %%a in ('echo !dt!') do set dt=%%a
echo !dt!
)
Where after the 3rd line the dt variable contains:
BOF PING GLOBAL ACTIVITY DATA OF 12/13/2006 TO REMOTE 123 BEGINS
HERE 12/13/2006 23:13:38
Is there a better way to extract the Date after DATA OF? Right now, I'm
replacing 2 spaces with 1 space multiple times so I can use the second for
loop to reliably extract the date. I'm just wondering what other ways there
are to do it.
TIA
Matt