Linux bash tool cut partially implemented in C++