Powershell Select-Object from array not working -


I have to separate values ​​in an array I'm trying to pass for any other task.

Using an inner select-object function for the loop, going through each line and separating the timestamp and value fields.

However, it does not matter what I do below the code only displays the first object object for each line. Another object object command does not work because of my output is a blank line for each 6 rows I

How any ideas about how to achieve both values ​​

  $ ReportData = $ SystemStats.get_performance_graph_csv_statistics ((, $ query)) ### -TypeName a new encoder allocation and byte array turn into a string $ ASCII = new-object System.Text.ASCIIEncoding $ csvdata = $ ASCII.GetString ($ ReportData [0] .statistic_data) $ csv2 = convertFrom- CSV $ Csvdata $ Newarray = $ Csv2 | Where-Object {. $ _ Using -ne "0k0000000000e +00" -and $ _ using -ne "Nan".} For ($ n = 0; $ n -lt $ newarray.Length; $ n ++) {$ Ntime = $ New $ [$ n] $ nUtil = $ new $ [$ n] $ util = $ nUtil | Use object selection $ util $ tstamp = $ nTime | Select-Object timestamp $ tstamp}  

Let slightly modified to me processing code, if This will help.

  $ csv2 | Where {$ _. Utility-one "0.0000000000e + 00" -and $ _ utility-a "nan"} | Selection-object use, timestamp  

This will produce some different output, but it should be better to work with that. Results are items with the use of objects and timeframe. You can tell them as another function.

Normally it is better to use pipes instead of loops, you do not need to pay attention to the indexes and it works with arrays as well as scalar values.


If my update code will not work: this timestamp is the property actually filled with any value?


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -