Avatar of elwayisgod
elwayisgod
Flag for United States of America asked on

VB Script modificatin needed

Hi,

Had a script done by RSampson last week that stripped a file and created a new file whenever it found |2102| in the Years column.  Problem is it runs on all files in a directory but the Years column is not always in the same column.  Additionally a data value could be 2012 also as I found out.  Thus I need some tweaks.  You will see below that the 2nd row of data contains |2012| however that's Units and not Years.  Thus current script grabbed that row which is a problem I didn't forsee.  So is there a way I can define which column to search for 2012 for each file?  So somewhere in the script I can list out the filenames and which column to look for 2012 in?  

Style 01 7 75 756 03 01 899833|Fiscal Rcpt Feb|MdseTyp F|2012|1938|6143.46|445.74|25174.6200000000|0.00|651193

Style 01 7 75 756 03 01 899833|Fiscal Rcpt Jan|MdseTyp F|2011|2012|6378.04|462.76|26135.8800000000|0.00|651194
splice.vbs
VB ScriptVisual Basic Classic

Avatar of undefined
Last Comment
elwayisgod

8/22/2022 - Mon
elwayisgod

ASKER
Here's the list of filenames and the column I need to search for 2012 in.
filenames-and-years-column.xlsx
elwayisgod

ASKER
Sample files
Load.zip
ASKER CERTIFIED SOLUTION
tempor2001

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
elwayisgod

ASKER
I get an error:


D:\AppFiles\SDS\SDS_Retail_R3\Data\Working\DataFiles\Spliced\VB>cscript splice.v
bs > splice.log
D:\AppFiles\SDS\SDS_Retail_R3\Data\Working\DataFiles\Spliced\VB\splice.vbs(1, 15
) Microsoft VBScript compilation error: Expected end of statement


D:\AppFiles\SDS\SDS_Retail_R3\Data\Working\DataFiles\Spliced\VB>
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
elwayisgod

ASKER
Never mind.. hold on a sec
elwayisgod

ASKER
Perfect.  Both the DOS and VB results are identical.  Thanks much!!!!