Newbie -- comparing two files

Hi

sorry if this is a really numpty question.  I have two CSV files which contain a sequence number and a filename. The control  contains a list of sequences 1 to 8, with the corresponding files.  the log contains the sequences and files which successfully got executed,  I want to compare the files and get the last sequence from the log, then pick up the next sequences from the control file, to resume a schedule.

I am a sql person, so basically I want to get a select max from  the log, then select all from the control which is greater than the max from log.  does that make sense.  

Can anyone point me in the right direction? I've done some pseudcode/powershell which I hope illustrates what I mean (apologies!)


$Control = Get-Content E:\Backup\Schedule_Run.csv
$result = Get-Content E:\Backup\Schedule_log.csv

$MAXExecuted  =  MAX($result.SEQ )

ForEach ($i in $control )

{

If ($i.SEQ -gt $MAXExecuted)

{

start-process $i.BatFile -Wait

}

}

}