I am trying to search several logs for a text string, make it validate with a condition and print the name of the file and a text:
ls -ltrh | awk '{
if ($0 ~ /successfully completed/) {print FILENAME,FECHACREACIÓN,"COMPLETADO_CORRECTAMENTE"}
else {print FILENAME,FECHACREACIÓN,"ERROR"}
};' *.log
The idea is that it validates in the last line if there is a string "successfully completed" and if it exists, it shows me COMPLETED CORRECTLY, and if it doesn't, it shows me an error.
But currently the chain does exist and it throws me an error.