I'm extracting .tgz archives with Powershell and 7zip. 7zip has a forced verbose mode and pollutes my screen. I just want to display the error messages. I already removed the standard messages with FIND:
Code:
Write-Host "Extracting "$strArgument
# extract tgz to tar
& "$7z" x "-y" $strArgument | FIND /V "ing " | FIND /V "Igor Pavlov" | FIND /V "Processing " | FIND /V "Everything is Ok" | FIND /V "Folders: " | FIND /V "Files: " | FIND /V "Size: " | FIND /V "Compressed: " | FIND /V "Processing archive: "
# path to .tar
$strArgument = $strArgument.Replace(".tgz", ".tar")
$strArgument = $strArgument.Replace("i\data\", "")
# extract tar to file
#Write-Host $strArgument
& "$7z" x "-y" $strArgument | FIND /V "ing " | FIND /V "Igor Pavlov" | FIND /V "Processing " | FIND /V "Everything is Ok" | FIND /V "Folders: " | FIND /V "Files: " | FIND /V "Size: " | FIND /V "Compressed: " | FIND /V "Processing archive: "
This gives me an output with lots of empty lines:
Extracting Q:\mles\etl-i_test\i\data\divider-bin.tgz
Extracting Q:\mles\etl-i_test\i\data\divider-conf.tgz
...
However I just want:
Extracting Q:\mles\etl-i_test\i\data\divider-bin.tgz
Extracting Q:\mles\etl-i_test\i\data\divider-conf.tgz
How can i remove the blank lines from my stream? Is there a mighty FIND switch?