9.7. Using the measure-object Cmdlet
The measure-object cmdlet allows you to measure or calculate properties of Windows PowerShell objects. One use of the measure-object cmdlet is to provide information on summary criteria, such as line count or word count, on files whose content is retrieved using the get-content cmdlet.
In addition to the common parameters, the measure-object cmdlet supports the following parameters:
InputObject — Specifies the input object. If the input comes from a pipeline, this parameter is omitted.
Property — Specifies a property on which the cmdlet is to operate.
Average — Specifies that the mean of some numeric items is to be calculated.
Sum — Specifies that the sum of numeric values is to be calculated.
Minimum — Specifies that the minimum value in a series of numeric values is to be found.
Maximum — Specifies that the maximum value in a series of numeric values is to be found.
Line — Specifies that a line count of text data is to be carried out.
Word — Specifies that a word count of text data is to be carried out.
Character — Specifies that characters in text data are to be counted.
IgnoreWhitespace — A boolean value that specifies whether or not whitespace is to be ignored. By default, whitespace characters are counted.
The -inputObject and -property parameters apply to numeric and text input. The -average, -sum, -minimum, and -maximum parameters are used with numeric input. The -line, -word, -character, and IgnoreWhitespace parameters are used with text input. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access