Removing duplicates from a file containing IP addresses
For all practical reasons, you should

    &gt; sort in.csv | uniq &gt; out.csv


from the command line, unless the goal is the programming exercise.

As mentioned in the comments, the bottleneck is a linear search over the list of encountered IPs. It drives time complexity quadratic. Sorting is a way to reduce the complexity.

If the file is indeed too large to fit into RAM (which I seriously doubt; these days 13M records shouldn't be a problem), use an external sort (merge works the best). You can also greatly reduce the memory consumption by keeping IPs as numbers (4 bytes per IP), instead of strings:

    in_addr_t addr;
    while(fgets(line, sizeof(line), in)) {
        bool rc = inet_aton(line, &amp;addr);
        if (!rc) {
            // Deal with malformed address
        } else {
            // Business as usual. Work with addr.
        }
    }