Skip to content

A dual-implementation (Python & C) utility to search for keywords across multiple text files and extract the surrounding context lines.

Notifications You must be signed in to change notification settings

MoayadAlnada/Text-Search-Context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Search Context

A file search utility implemented in both Python and C. It scans a directory of text files for a specific keyword and extracts the matching line plus surrounding context.

Features

  • Dual Implementation: Available in both Python (Searchtxt.py) and C (main.c) for performance comparison.
  • Context Extraction: Captures the line containing the keyword + the next 2 lines.
  • Performance: C implementation typically offers faster processing for large datasets.
  • Context-Aware: Ideal for log analysis or mining text data where context matters.

Structure

  • Searchtxt.py: Python implementation.
  • main.c: C implementation.
  • word.txt: Config file containing the search term.

Usage (Python)

  1. Ensure your .txt files are in a textfiles/ folder (input).
  2. Edit word.txt to contain your search term.
  3. Run:
    python Searchtxt.py
  4. Results are saved to results.txt.

About

A dual-implementation (Python & C) utility to search for keywords across multiple text files and extract the surrounding context lines.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published