Explain how you would write a Unix shell script to parse log files, extract specific error codes, and trigger an alert.