I want to walk a file and compare two lines to see if they begin with the same 12 characters. If they do, I want to delete the first line and then compare the remaining line with the next line in the file until all lines have been compared.
The file contains the list of files in the directory, already sorted. There can be two or more files (always in sequence) that start with the same 12 characters. I only want the last one.
I saw a similar solution, in an early post:
sed '$!N; /\(.*\)\n\1:FOO/D; P;D' file
but I could not modify it to work for me.