Sample Header Ad - 728x90

Using pcregrep to search for exact matches of multiline string

0 votes
0 answers
187 views
I am trying to search a directory using pcregrep. I want to search using a long, multi-line string. Basically, I am trying to look through multiple code bases for plagiarism. So I want to be able copy/paste a code block from some code, and then search a directory for any exact matches. The problem I'm having is that when I use pcregrep with the -M option (pcregrep -M), it appears to treat each line break as a separate pattern. So, when I take a code block that I know is unique to one file, I may still get multiple responses because some individual lines may be used elsewhere. Here is what I am using: pcregrep -FlMr "long, multi-line string" /directory/to/search/ What can I do to make sure that it will only return exact matches?
Asked by Lee Morgan (101 rep)
Jun 1, 2023, 02:59 PM
Last activity: Jun 1, 2023, 07:44 PM