I have a file, in which the first string before the comma is some kind of identifier. Here is a sample:
A, bla, bla...
B, bla, bla...
A, bla, bla...
C, bla, bla...
I need to parse a file to collect all unique occurences of this string. So, ideally, after processing I would have some kind of array [A, B, C]
. The problem is that officially arrays are not supported in batch scripting. I know there are some workarounds, but the ones I checked out looked quite ugly.
What I have so far, is something like this:
FOR /F "tokens=1 delims=, " %%i in (%FILE%) do (
echo %%i
)
This produces the output:
A
B
A
C
How do I eliminate the duplicate occurences of a string? What would be the elegant way to achieve this?
Please, share your thoughts, on how this problem could be solved.