Skip to content

Instantly share code, notes, and snippets.

@Cvetomird91
Created March 20, 2018 08:09
Show Gist options
  • Save Cvetomird91/65002da88f8480847225f8367c224374 to your computer and use it in GitHub Desktop.
Save Cvetomird91/65002da88f8480847225f8367c224374 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <boost/regex.hpp>
#include <boost/algorithm/string/find.hpp>
const boost::regex frequency_line("^Matches found.*$");
int main(int argc, char* argv[]) {
std::ifstream is("");
std::vector<std::string> *frequency_data_lines = new std::vector<std::string>;
std::set<std::string> *test = new std::set<std::string>;
std::string search_string("");
std::string current_frequency_line;
for (std::string str; std::getline(is, str);) {
//std::cout << str << std::endl;
boost::smatch match;
if(boost::regex_match(str, match, frequency_line)) {
//frequency_data_lines->push_back(str);
//test->insert(str);
current_frequency_line = str;
}
boost::iterator_range<std::string::const_iterator> rng;
rng = boost::ifind_first(str, search_string);
if(rng) {
test->insert(current_frequency_line);
}
}
for (std::set<std::string>::iterator it = test->begin(); it != test->end(); ++it)
std::cout << *it << std::endl;
delete frequency_data_lines;
delete test;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment