Read only certain lines from CSV File

I am trying to read lines from a CSV file and put the values into vectors. The CSV contains a large amount of data and I would like the program to only read certain lines from the CSV into the vectors. An example of the data is below. In my code the user inputs a secid. I would then like the code to only read lines from the csv where the secid matches what the user inputs. The secid's are also not in order so I can't just use a while loop.

My current code is below the data.

secid effect_date cusip ticker
101310 14MAY1997 2313510 AMZN
101310 08MAY1998 2313510 AMZN
101310 28NOV2000 2313510 AMZN
101310 23JUL2001 2313510 AMZN
101966 01JAN1996 63858510 NB
101966 01OCT1998 06605F10 BAC

ifstream infile3("filepath.csv");
if (!infile3) {
cerr << "Couldn't open file!"<<endl;
return 1;
}
while(getline(infile3,line)){
if(line[0]>='0'){
istringstream iss(line);
getline(iss,line_seg, ',');
secid1.push_back(line_seg);
getline(iss,line_seg, ',');
effect_date.push_back(line_seg);
getline(iss,line_seg, ',');
cusip.push_back(line_seg);
getline(iss,line_seg, ',');
ticker.push_back(line_seg);
}
}
infile.close();

Any help would be greatly appreciated!
Read line.
Check secid.
If it matches, continue with storing values
If not, read next line.
Topic archived. No new replies allowed.