Skip to content

Latest commit

 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Processor CLI

A lightweight command-line text processing tool written in C++. It provides utilities for searching, replacing, transforming and analyzing text files directly from the terminal. Architecture & Design Patterns

This tool was built with scalability and performance in mind:

  • Pattern: Implements a Strategy Pattern via a common transformation interface, allowing easy extension of new features.
  • Extensibility: Uses a Dispatch Map (Registry) for flag handling, enabling O(1) command lookup and modular integration.
  • Efficiency: Employs Stream-based processing to handle large files with minimal memory overhead (processing line-by-line).
  • Principles: Adheres to the Open/Closed Principle, making it easy to add new flags without modifying the core logic.

Features

  • Find occurrences of words in text files
  • Replace text with optional match limits
  • Convert text case (uppercase / lowercase)
  • Remove duplicate lines, words or characters
  • Count words and characters
  • Limit number of matches using the -t flag

Build

Use this command on the root project folder:

cmake -S . -B build
cmake --build build

Usage

Examples

Find a word

Find all occurrences of a word in a file:

txtprocessor -i input.txt -f word

Limit the number of matches:

txtprocessor -i input.txt -f word -t 3

Replace text

Replace a word with another one:

txtprocessor -i input.txt -r word newWord

Limit the number to replace:

txtprocessor -i input.txt -r word newWord -t 5

Case Conversion

Convert text to uppercase:

txtprocessor -i input.txt -case -up

Convert text to lowercase:

txtprocessor -i input.txt -case -low

Deduplication

Remove duplicate lines:

txtprocessor -i input.txt -d -l

Remove duplicate words and characters:

txtprocessor -i input.txt -d -wch

Count

Count words:

txtprocessor -i input.txt -c -w

Count words and characters:

txtprocessor -i input.txt -c -wch

About

A high-speed C++ utility for automated text manipulation. Built with CMake and modern C++17, this tool is designed for developers who need to process large logs or text files without leaving the terminal.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages