[problem]
Have you ever duplicated a cron entry, or just wanted to find duplicate lines in a file.
[/problem]
[solution]
Here is a simple one liner, which shows all lines which occur more than once in a file or standard output.
[/solution]
[example]
sort cronfile.223 | uniq -c | awk ' $1 != 1 '
So to check that cron directly – just do this:
crontab -l | uniq -c | awk ' $1 != 1 '
[/example]
[reference]
[tags]UNIX, awk, script, uniq, Unix Coding School[/tags]
[/reference]
If you have found my website useful, please consider buying me a coffee below 😉