Display occurences

Display occurences of lines ending with “,2018” in all CSV of a folder

select-string *.csv -pattern ",2018$"

Display occurences of “{a word},{some digits}” in all CSV files in a folder and its subfolders (recursive version)

select-string -rec *.csv -pattern "\w+,\d+"

Count occurences

Template to count occurences

(get-content my_file | select-string -pattern "my string").length

Count the number of functions in a PHP Class file

(get-content MyClass.php | select-string -pattern " function ").length

Count the number of function is all Java files in the actual folder

(get-content *.php | select-string -pattern " function ").length

Count Lines

Get-Content file.xml | Measure-Object Line

Count Characters

Get-Content file.xml | Measure-Object Character

Count Words

Get-Content file.xml | Measure-Object Word