Solved

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

Posted on 2010-09-13
3
630 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

734 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