Find and report all occurrences of duplicate lines in a text file
I don't know about Awk, but for this section of code:

END {
# If the file contains no lines to process, that is, it's empty,
# return an exit status code of 1 to indicate the fact.
if (!(NR &gt; 0)) {
    exit 1;
}


You should print out an appropriate message to the terminal instead of just exiting with exit code 1. This, in my opinion, provides users with better feedback.