Solved

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

Posted on 2010-09-13
3
624 Views
Last Modified: 2012-05-10
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
Comment
Question by:someITGuy
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
wmehardt earned 500 total points
ID: 33664949
(gci *.csv | select-string "<string here>" | measure-object).count
0
 

Author Comment

by:someITGuy
ID: 33665250
Are the brackets ( )  in the correct place?
0
 
LVL 4

Assisted Solution

by:wmehardt
wmehardt earned 500 total points
ID: 33665501
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now