Get count from Powershell Group-Object -


i trying stats our code. works fine 1 module:

function counttestcases($path=$pwd) {    get-childitem $path -recurse -include *.java | where-object {-not $_.psiscontainer } |     select-string "extends componenttestcase", "extends databasedependenttestcase" | group-object pattern | select-object count } 

but want run across modules csv output this:

module,#componenttestcase,#databasedependanttestcase module1,20,30 module2,12,1 

unfortunately, if add

| select-obejct count 

it doesn't work (although name does). not sure how around without writing code...

i couldnt simpler find way.. seems works

get-childitem $path -recurse -include *.cs | select-string "int", "string" | group-object pattern -ashashtable | foreach {     new-object psobject -property @{         int = $_['int'].count;         string = $_['string'].count;         module = 'mymodulename'}     } | select module, int, string 

the output looks like

module                                            int                    string ------                                            ---                    ------ mymodulename                                       19                        78 

i'm using string , int patterns, you'll have replace yours


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -