1.

Solve : Substrings of tokens?

Answer»

I am trying to use DOS to filter lines from one file to another.

I have the LIST of registered DLLS from a system in the file Regfiles_sys1.txt in this format:

junk1.dll {0000000} C:\Program Files\jnk\Junk1.dll [Junk 1.0 Type Library]
junk2.dll {0000000} D:\Program Files\jnk\Junk2.dll [Junk 2.0 Type Library]
junk3.dll {0000000} C:\Program Files\jnk\Junk3.dll [Junk 3.0 Type Library]
one.dll {0000000} D:\Program Files\jnk\one.dll [one Type Library]

I only want the c:\ records in the new output file.

This is my CODE snippet so far which does not WORK:

for /F "usebackq" %%i in (`dir /b regfiles_*.txt`) do (call :No_D %%~ni)
goto :EOF

:No_D
if {%1}=={} goto :EOF
if exist %1.tmp del %1.tmp

for /F "tokens=1,2* delims=}" %%i in (%1.txt) do (
if /i "%%j:~0,3%" NEQ " d:" (echo %%i}%%j>>%1.tmp)
)
goto :EOF


^John
P.S. I do not know how to use the delay translate (!) or if it will help here.Quote from: Herkimer on October 16, 2007, 08:14:58 AM

I only want the c:\ records in the new output file.

Code: [Select]findstr /I "c:\\" file > newfile
Thank you.
It works but my actual problem is a little more comlpex.

I could Pipe a few of these together to do more tuning I guess.

I was hoping for a more programmatic option so it could be customized to the situation.


Discussion

No Comment Found