Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-09-13
3
Medium Priority
?
632 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 2000 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

670 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