I am trying to read a source file, then output only lines that start with a specific string to a new file. The issue that I am having is that the lines are long (1000+ chars) and the outputted lines are wrapping. Each full line in the source file needs to be the same full (unbroken) line in the target file.
$data = get-content "C:\TEST\INBOUND\DATA\TEST_IMP.TXT"
foreach($line in $data)
{
if($line.length > 2){
if($line.substring(0,2) -eq "AZ" )
{
write-host $line | out-file -filepath "C:\TEST\INBOUND\DATA\TEST_OUT."
}
}
}Any help would be MUCH appreciated.