If I have a text file, I can sort it by command sort input.txt output.txt. Can I somehow also remove duplicate lines from the text file as well. (Ideally I would like a solution which can be done in a batch file under Windows.)
This is basically the same as asking how to remove duplicates from text file. (Since obviously I can sort first and then use a batch to remove duplicates.) The reason I have also mentioned sorting is that I assume that it is easier to remove duplicates if we know that file is sorted and they can only appear on consecutive lines. So I guess it is more likely that there is some way to remove duplicates together with sorting. (And for the purposes where I want to use this id does not matter if the order of lines in the file is changed, as long as the repeated lines are removed.)
For example from the file looking like this:
100 100 100 100 101 101 102 I would like to get
100 101 102