powershell - Pipe to Out-GridView and Out-File got different rows? -


the following command returns 1 row (the parameter -context 10 ignored.)

select-string -path file.txt -pattern "..." -context 10 | out-gridview 

however, following command create file lines.

select-string -path file.txt -pattern "..." -context 10 | out-file file2 

why there difference?

this because out-gridview consumes entire matchinfo object select-string outputs, , displays of properties of object columns. out-file on other hand performs tostring() method on before outputs file, , kind of object when converts string outputs line, , context lines well. if want out-gridview have pipe out-string , out-gridview.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -