VB Script to mimic this DOS Batch Script
Posted on 2012-12-25
I have a DOS script working great. Problem is it takes 45 min to churn through files. Some are pretty big. Was wondering if there could be and equivalent VB script that could possibly churn through this faster?
REM get a file name and the YEAR column
for /F "tokens=1,2 delims=|" %%A in (filelist.txt) do call :Extract %%A %%B
:Extract FileName YearColNo
@echo Processing file %filename%
REM Get the header line
for /F "usebackq delims=" %%F in ("%filename%") do if not defined head set head=%%F
REM Construct RegEx for matching the correct year column
for /L %%L in (2,1,%colno%) do set "pat=!pat![^^|]*|"
> 2004_%filename% echo,!head!
>>2004_%filename% findstr /R "%pat%" %filename%
REM Head will be added automatically
REM > Non_2004_%filename% findstr /V /R "%pat%" %filename%