Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 633
  • Last Modified:

Script to find count of a string in a .cvs file - Powershell

I need to write a script to scan a group of .csv files and return a total of lines a specific string occurs on.

Preferably Powershell.
0
someITGuy
Asked:
someITGuy
  • 2
2 Solutions
 
wmehardtCommented:
(gci *.csv | select-string "<string here>" | measure-object).count
0
 
someITGuyAuthor Commented:
Are the brackets ( )  in the correct place?
0
 
wmehardtCommented:
Yup, are you having issues? What is the string you are looking to match? You can also do it this way with no parentheses


Select-String -path c:\folder\*.csv -pattern "string" | measure-object | select count
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now