I need a shell script or C programm that will parse a file and will look for duplicate entries.
What is that file :
This file is a configuration file. Other scripts run and write this file, then these multiple configurations are concatenated in one single file. However if there are 2 exactly same configurations in that file then the server crashes.
What must the script do :
1. Remove the duplicate line but under each duplicate line it must also erase the next 4 lines.
2. It must keep the duplicate line and the 4 lines below that it found to a separate log file.
3. It must then email this log file only if there where duplicate lines.