Today' we will talk about Measure-Object cmdlet which helps you peforming average, max, min and other operations. Before we perform some tests, we need to create a file with some data. My file is as follows :
name,age
Som,25
Ravi,30
Akash,60
Jack,89
John,16
Save the above as file.csv. You can use below command to see the statistics :
import-csv C:\engg.demo\file.csv | measure-object age -ave -max -min
Output:
Count : 3
Average : 38.3333333333333
Sum :
Maximum : 60
Minimum : 25
Property : age
In measure-object, we mentioned the column name against which you want to run certain operation. After that, you can mention from below :
-ave : Average
-min : Min
-max : Max
-sum : Sum
Enjoy scripting!!
name,age
Som,25
Ravi,30
Akash,60
Jack,89
John,16
Save the above as file.csv. You can use below command to see the statistics :
import-csv C:\engg.demo\file.csv | measure-object age -ave -max -min
Output:
Count : 3
Average : 38.3333333333333
Sum :
Maximum : 60
Minimum : 25
Property : age
In measure-object, we mentioned the column name against which you want to run certain operation. After that, you can mention from below :
-ave : Average
-min : Min
-max : Max
-sum : Sum
Enjoy scripting!!
No comments:
Post a Comment