Skip to content
Advertisement

Tag: pcregrep

Pcregrep include file extension bug

I’m using pcregrep to search for a multiline pattern, and I only want pcregrep to search through files with specific file extensions, i.e. pcregrep -Mrl –include=*.sv -e ‘<my_multi-line_pattern>’ /path/to/search However, this throws an error: pcregrep: Error in ‘include’ regex at offset 0: nothing to repeat. I’ve tried escaping & double-escaping the * to no avail. This syntax seems to work

How can I search for a multiline pattern in a file?

I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using find piped with xargs grep: But if I need to find patterns that spans on more than one line, I’m stuck because vanilla grep can’t find multiline patterns. Answer So I discovered pcregrep which stands for Perl Compatible

Advertisement