Hello,
i'm having a problem with creating of a script that would split my txt input to smaller files named by the server and sent every line from input to its corresponding file.
My input look like this (it's a single file):
\server1share1axxxxx
\server2share1axxxxa
\server3share3aaxxax
\server1share2axaxaxa
..
There could be 50k of lines with different unc`s, but there will be less than 100 unique server names inside of the file.
So for searching of server names i should create collection with server names, or second file (copy of the first one). Than i should use regex/substring, start from third sign and go to ninth sign in each line (server naming convention is always the same). Filter trimmed names for unique ones and foreach unique name create output file $servername.txt, is that correct?
Now how to send every line to its corresponding output file? =|
So the \server2share1axxxxa >>server2.txt
\server100share100bxxxxx >> server100.txt
\server2share5axkpwi >> server.txt
At the end i'm deleting second file.
Thanx for any help