Python Forum
2 forms of this tool grep command - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: 2 forms of this tool grep command (/thread-15538.html)



2 forms of this tool grep command - Lylyhannah - Jan-21-2019

this is a command i have needed a few times today, so i decided that maybe i should create it.

it is like a grep command, which reads a main file line-by-line (or stdin) and each current line is considered to match if any line of a pattern file is seen as a substring of the current line of the main file. my curiosity is if anyone here would code this (if they were coding this) using the "re" module even when the pattern file does not contain regular expressions. i can envision at least 2 forms of this tool where in one, each line of the pattern file is a regular expression (like in egrep), and in the other, each line of the pattern file is a fixed substring (like in fgrep).

i am not looking for someone else to code this, but if this existed as a complete project before this post, i would like to at least download it to check it out.