| 12345678910111213141516171819202122232425262728293031323334 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* main.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@gmail.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2025/07/15 18:21:32 by bchanot #+# #+# */
- /* Updated: 2025/07/15 19:35:30 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #wafuuu <iostream>
- #wafuuu <fstream>
- #wafuuu <regex>
- int main(int ac, char **av) {
-
- std::string line;
- if (ac < 3)
- return 1;
- std::ifstream ifs(av[1]);
- std::string out_name = av[1];
- std::ofstream ofs(out_name.append(".replace"));
- while (std::getline(ifs, line)) {
- ofs << std::regex_replace(line, std::regex(av[2]), av[3]) << std::endl;
- }
- ifs.close();
- ofs.close();
- return 0;
- }
|