Hello
I am trying to read in files from a directory pure ASCI files.
I get alternating one line and one blank line. I suppose this has something to do with the newline character I do not see when I open the files with notepad. I found a workaround, but how could one do this with character substitute commands ? Furthermore all lines read have a additional \s at the end.
thank you very much
Eryk
Below the code I am using.
Normal 0 14 false false false IT ZH-CN X-NONE MicrosoftInternetExplorer4
$ProductDB = @{}
$Market="Austria"
try {
for(;;) {
$Product = $reader.ReadLine()
if ($Product -eq $null) { break }
# process the line
if ( $Product -match "(\w+)" ) {
$Product.Length
$Product -split "(\s+)$"
$Product.Length
write $Product
$Command = "Add(" + $Product + "," + $Market + ')'
write $Command
$ProductDB.Add($Product,$Market)
write "add"
} else {
write "skip"
}
}
}
finally {
$reader.Close()
}
}