Hi my current code is:find /home/user/logfilesError/ -maxdepth 1 -type f -name gBatch_*\ -daystart -mtime -1 -exec grep -rl ERROR {} +  | xargs -l  basenameif [ $? -eq 0 ]; then    tday=$(date +'%d.%m.%Y')    echo ERROR found on $tday in the files obove!else    tday=$(date +'%d.%m.%Y')    echo No ERROR was found at the $tday !fiThe code currently outputs the logfiles wich are created or edited this day(not last 24 hrs) and searches if the logfiles contain ERROR and simply says in which logfiles is an error or if there arent any error he says that aswell. I censored the names a bit so dont think I messed that up and thats why it doesnt work ;-)Output(example):gBatch_2070.loggBatch_2071.logERROR found on 25.06.2014 in the files obove!The folder looks like:Each file looks like:My desired output:Name of the file + ERROR + the message after the errorExample:gBatch_2067.log - ERROR **.batch.BatchStart = Batchverarbeitung beeendet, gBatch_2077.log - ERROR **.batch.BatchStart = Batchverarbeitung beeendet, ... Thank you in advance for your help!
Output multiple strings out of multiple files
bash;shell script;find