Author name: greg

Grepping for multiple strings in a file

We will use egrep which accepts a regular expression to grep for multiple strings. tail -f localhost_access_log.txt | egrep “\” 404|\” 500″ Here our example looks at logs to see if we got 404 or 500 request. “GET /favicon.ico HTTP/1.1” 404 973 “GET /login.html HTTP/1.1” 500 1230 “GET /favicon.ico HTTP/1.1” 404 973

Tokenizing/splitting string in c++

This method uses strtok to tokeninze our string given a specific delimeter, results of that are put into supplied vector. There are few other ways we can do this but this one is straight forward. #include <iostream> #include <string> #include <string.h>   #include <memory> #include <stdlib.h> #include <stdio.h> #include <list> #include <vector>   using namespace …

Tokenizing/splitting string in c++ Read More »