BelgoCanadian
BelgoCanadian

Reputation: 934

Grep multiline regex

consider the following

[Settings]
Flags=17
InHouse=0
PrintMode=4
version=3.0
Background Color=16051165
AutoSaveMin=900000
DefaultTemplate=Untitled.ipt
Save template=1

I'm using grep to loop through thousands of ini files to look for the following:

version=3.0

AND

DefaultTemplate=[alphanumeric]

below does not return any results, what am I missing?

version=3.0[\s\S]*DefaultTemplate=[A-Za-z0-9]

Upvotes: 0

Views: 502

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185831

Try this:

grep -P '(DefaultTemplate=[\w\.]+|version=[\d\.]+)' *

Upvotes: 1

Related Questions