Is there a way to filter the output of a batch file using regex or anything similar ?
In short this is my scenario : I need to clean up log files for further analysis, but due to the size of them I want to downsize them first. The original file is a space delimited file, and I know that for each line the 5th item is what I need.
So far so good, the following file kind of gives me what I need :
@echo off & setLocal enableDELAYedexpansion
@title = logger
for /f "tokens=*" %%a in (test.log) do call :getURI %%a
pause
goto :eof
:getURI
echo %5 >> cleaned.txt
goto :eof
:eof
This gives me the desired output as follows
some_url.html
test.html
some_other_url.html
test.html
test.html
yet_another_url.html
...
Now, it still takes an awful lot off time to generate this file, so I was wondering if there are more efficient ways to do this, and whether it would be possible to filter the output also. I still have for instance quite some [test.html] in the output (fictional example) and I prefer to strip them out upfront, so my outcome would become
some_url.html
some_other_url.html
yet_another_url.html
...
Any advices ?