Wahing together csv files

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
cgolembewski
Newbie
Posts: 1
Joined: Fri Jun 05, 2009 1:37 pm

Wahing together csv files

Post by cgolembewski » Fri Jun 05, 2009 2:46 pm

Hi All,

I'm looking for a better (faster) way to wash two csv's of the same format together. the two files can be matched on field 2. File "A" is complete,
file "B" contains a subset of rows to be updated.

My simplistic (s l o w ) script reads a line from b, loops through a, and writes the appropriate line to a new file. As file a is 12K lines by 45 cols, and
file b is roughly 100 lines, my script takes 10 mins.

Anybody have a better method?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jun 05, 2009 3:24 pm

Here's a sample using DOS find to get the line number so you don't have to scan all the way through the file each time.

Code: Select all

Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>cmd /c dir C:\ > %temp_dir%C_Drive_List.txt
Run>cmd /c find /n /i "Windows" %temp_dir%C_Drive_List.txt > %temp_dir%C_Drive_List_Look.txt

ReadLn>%temp_dir%C_Drive_List_Look.txt,3,line

DeleteFile>%temp_dir%C_Drive_List.txt
DeleteFile>C_Drive_List_Look.txt

MDL>line

Separate>line,],LineNumber
Midstr>LineNumber_1,2,100,LineNumber

MDL>LineNumber

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts