Skip to content

Lexstok/Search-string-of-words-in-text-and-display-corresponding-paragraphs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Small python script to search for one or more words in a file and display the corresponding paragraphs.

Adaptation from C code found on http://forums.macrumors.com/showthread.php?t=1833952

Program to read text from a file, buffering text and searching for a string.
When 2 CRs are found (a paragraph) if a match was found in it the buffer is
printed.  The buffer is cleared and reading continued.
The effect is to print the entire paragraph if it contains a match.

Usage: python stringintext.py -s one or more words to search for -f filename

Parapgraphs are defined as having two empty lines between them.

About

Search for one or more words in a file and display the corresponding paragraphs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages