-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path1030.ps1
More file actions
30 lines (29 loc) · 840 Bytes
/
Copy path1030.ps1
File metadata and controls
30 lines (29 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#.Synopsis
# Calculate statistics about files
#.Description
# A lightweight simulation of unix's "wc" word count application
#.Parameter $file
# Accepts PIPELINE input
# The file name(s) or wildcard patterns for the file(s) you want to count
#.Example
# wc *.ps1
#
# Calculates line, word, and character counts for powershell script files in the current directory.
#.Example
# wc *.ps1, *.psm1, *.psd1
#
# Calculates line, word, and character counts for powershell script and module files
#
function Measure-File {
Param([string[]]$file)
PROCESS{
if(!$file -and $_)
{$file = $_}
# wrap it with get-childitem so we do each file...
foreach($f in ls $file){
gc $f -delim [char]0|
measure -line -word -char |
select Lines, Words, Characters, @{n="Name";e={$f.Name}}
}
}}
new-alias wc measure-file