How can I determine a pattern exists over multiple lines with grep? below is a multiline pattern I need to check is present in the file
Status: True Type: Master
I tried the below command but it checks multiple strings on a single line but fails for strings pattern match on multiple lines
if cat file.txt | grep -P '^(?=.*Status:.*True)(?=.*Type:.*Master)'; then echo "Present"; else echo "NOT FOUND"; fi
file.txt
Interface: vlan Status: True Type: Master ID: 104