I've got a string array collected from a list of log files on a RHEL machine, and I want to identify unique lines in the array that do not have an identical matching line in a file, but I can't figure it out with google :-(
This bit collecting the Array works OK
IFS=$'\n'
Z=( $(/usr/bin/grep -ir --exclude="*_audit.log" ' error' /var/log/*.log | grep "$(date +"%b %_d")" | grep -sv "$non_issue") )
I can't figure out looping through Z and checking if there is a matching line in the log file.
if line in Z does not match any line in /report.log #repeat for each line in Z
then
echo this unique line
fi
The lines of text are log file outputs so there are a lot of special characters in them like /, ", :, etc.
Z =(...or is that just a typo here in the question and the actual code isZ=(...?