J'ai un fichier texte contenant environ 900 IP. J'ai besoin de créer un lot de 100 IP de ce fichier et de les produire dans de nouveaux fichiers. Cela créerait environ 9 fichiers texte.
Notre API ne permet de poster 100 IP à la fois. P>
Pourriez-vous m'aider ici? P>
ci-dessous est le format du fichier texte 10.86.50.55, 10.190.206.20, 10.190.49.31, 10.190.50.117, 10.86.50.57, 10.190.49.216, 10.190.50.120, 10.190.0.00.08, 10.86.50.94, 10.190.38.181,10.190.50.119,10.86. 50.53, 10.190.50.167, 10.190.49.30, 10.190.49.89, 10.86.50.115,10.86.50.54,10.86.50.59, 10.86.50.59, 10.190.50.210, 10.190.50.172, 10.190.49.21,10.86.49.18, 10.190.50.173,10.86.49.49,10.190.50.171, 10.190.50.174, 10.86.49.63, 10.190.50.175, 10.13.49.27, 10.190.49.19, 10.86.49.29, 10.10.12.49.28,10.190. 49.62, 10.86.50.147,10.86.49.24,10.86.50.146, 10.190.50.182, 10.190.50.25,10.190.38.252, 10.190.50.57, 10.86.50.54,10.86.50.78,10.190.50.23,10.86.50.8,10.86.50.80, 10.190.50.53, 10.190.49.229, 10.190.50.58, 10.190.50.130, 10.190.50.22.10.86.68.61, 10.19.68.61, 10.190.50.56, 10.190.50.563, 10.190.49.55, 10.190.49.66,10.190. 49.68, 10.190.50.86,10.86.49.113,10.86.49.114,10.86.49.10.10.10.190.50.150,10.190.49.184,10.190.50.152, 10.190.50.151, 10.10.86.49.43, 10.190.192.25,10.190.192.23,10.190.49.115, 10.86.49.44,10.190 .38.149, 10.190.38.151, 10.190.38.150,10.190.38.152, 10.190.38.145, 10.190.38.141, 10.190.38.148, 10.190.38.142, 10.190.38.144.10.190.38.147.10.190.38.143, 10.190.38.146,10.190.192.26 , 10.190.38.251, 10.190.49.105, 10.190.49.110, 10.190.49.137, 10.190.49.242, 10.190.50.0.72, 10.86.49.16, 10.86.49.16, 10.10.86.49.112,10.86.49.32,10.86.49.11,10.86.49.11,10.190 .49.150,10.190.49.159, 10.190.49.206,10.86.52.28,10.86.52.28,10.190.49.151,10.80.49.207,10.86.49.103,10.190.38.101.10.190.38.116, 10.190.38.120,10.190.38.102,10.190.38.123 , 10.190.38.140,10.190.198.50,10.190.38.109, 10.190.38.108, 10.190.38.111, 10.190.38.112, 10.190.38.113, 10.190.38.114, 10.10.86.40.43, 10.86.49.23,10.86.49.205,10.86 .49.220, 10.190.50.230, 10.190.192.238, 10.190.192.237,10.190.192.239, 10.190.50.0.0.10.190.50.0.0.10.86.50.86,10.190.38.125, 10.190.38.127, 10.190.38.126.10.190.50.127,10.190.50.149 , 10.86.49.59, 10.190.49.158, 10.190.49.157, 10.190.44.11, 10.190.38.124, 10.190.50.153, 10.190.49.40, 10.190.192.235, 10.190.192.236,10.190.50.241,10.190. 50.240, 10.86.46.8.10.190.38.234, 10.190.38.233,10.86.0.163, 10.86.50.180, 10.86.50.164, 10.86.50.164, 10.190.49.245,10.190.49.244.10.190.192.244.10.190.38.130,10.86.49.142,10.86.49.102, 10.86.49.141,10.86.49.67,10.190.50.206,10.190.192.243,10.190.243,10.190.192.241 P>
J'ai essayé d'avoir cherché en ligne pour trouver un peu de code de travail mais je ne peux pas vraiment penser à ce qui travaillerait mieux cette situation p>
3 Réponses :
Cela fera ce que vous allez après
$bulkIP = (get-content H:\IP.txt) -split ',' $i = 0 # Created loop Do{ # Completed an action every 100 counts (including 0) If(0 -eq $i % 100) { # If the array is a valid entry. Removing this will usually end up creating an empty junk file called -1 or something If($bulkIP[$i]) { # outputs 100 lines into a folder with the starting index as the name. # Eg. The first 1-100, the file would be called 1.txt. 501-600 would be called 501.txt etc $bulkIP[$($i)..$($i+99)] | Out-File "C:\path\to\$($bulkip.IndexOf($bulkip[$($i)+1])).txt" } } $i++ }While($i -le 1000)
Qu'est-ce que cela fait ...
Voici le code ... p> sortie d'écran ... p>
Essayez ceci
Un simple
\ d + \. \ D + \. \ D + \. \ D + code> feront. Ou divisé avec
, code>