FG

Grep multiline pattern

Fresh3 days ago
Mar 15, 202639781 views
Confidence Score0%
0%

Problem

How do I search for a phrase over multiple lines? E.g. Lets have the phrase "my ice tea" then it may be wrapped in text files: grep will not match since there is a newline in between. How do I match those? Another multiline pattern would be I know the easiest way I do ATM is just grep for one part …

Error Output

as js skdfh dfh djh sf my
ice tea.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Grep multiline pattern

Low Risk

You could install (available in most distro repositories) - which is grep using the pcre library, which does "Perl Compatible Regular Expressions". It has a command line option which allows you to do multiline searches - from the man page: "The outp…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment