Thanks for your elaborate response.
I'm just a beginner with GNU/Linux. I know my terminal code is more
like a patch work and doesn't look that professional yet.
I shortened valbug.txt only to the lines around the (apparent) bugs
with Gedit and looked at the edited file in a hexviewer. There was no
\r\n visible (just \n) and all the duplicate lines looked the same to
the byte.
I expected, that Gedit would NOT change the line endings or it would
at least tell me, that it did. That's where I went wrong.
Next time I'll use grep and od to verify it directly in the terminal
such that no unexpected conversions with the line endings can happen.
>Also, it appears that the data you posted may have used some sort of
>simple substitution cypher
These are some artificial city names for an exercise and it is/looks
likely that substitution on real names was used to generate them.