I'm doing a program that can find a file(s) that match two patterns given by the user (Date and ID), both patterns are located in different lines inside every file. The files are located in different .zip sub folders. My code is not working and I'm trying to use PCRE DOTALL.
File Sample:
TextTextTextTextText
TextTextText: [20-MAY-2017]
TextTextTextTextText
TextTextTextTextText
TextTextTextTextText
TextTextText: [123456]
Code I'm using:
echo "Set a specific Date [ DD-MM-YYYY ]: "
read -r Date
echo -e "Introduce ID: "
read -r ID
#Search pattern
grep -Pzo '(?s)$Date.*\n.*$ID' .