Hello all,
Iam making a script to extact some info from a text file.
The folloing script extracts \\share\temp\LDA\CA\0057\EN-XL-TAS-IC-0057_m0143.T and \\share\temp\LDA\CA\0057\EN-XL-TAS-IC-0057_m0144.TIF from text file.
foreach ($file in $files){
$file1=$file.Name
#echo $file1
$reader=[System.IO.File]::OpenText("C:\Users\camone\Desktop\teste1\$file1")
#$line.Split(":",$option)[3]
#$reader = [System.IO.File]::OpenText("C:\Users\camone\Desktop\teste\$file1")
try {
for(;;) {
$line = $reader.ReadLine()
if ($line -eq $null) { break }
#process the line
#$option = [System.StringSplitOptions]::RemoveEmptyEntries
$option = [System.StringSplitOptions]::none
#$line.Split(":",$option)[3]
$line.Split(":")[3]
# echo ........
}
}
finally {
$reader.Close()
}
}
So my problem is with example1 text beacause it has an enter and i cant retrieve all file information. My output will be "C:\Support\Scripts\terminados\copy_0057.log-error.log:3:\\share\temp\LDA\CA\0057\EN-XL-TAS-IC-0057_m0143.T" instead of "C:\Support\Scripts\terminados\copy_0057.log-error.log:3:\\share\temp\LDA\CA\0057\EN-XL-TAS-IC-0057_m0143.TIF".
Can anyone tell me how can i achieve the desired output?
Example1:
C:\Support\Scripts\terminados\copy_0057.log-error.log:3:\\share\temp\LDA\CA\0057\EN-XL-TAS-IC-0057_m0143.T
IF
Example2:
C:\Support\Scripts\terminados\copy_0057.log-error.log:3:\\share\temp\LDA\CA\0057\EN-XL-TAS-IC-0057_m0144.TIF
Regards,
Arestas