Link to home
Start Free TrialLog in
Avatar of Techop09
Techop09

asked on

Filter Huge Text File Based on Search String through Powershell

Hi,

I have a HUGE text file (over 10 GB) that has an export of ACLs from over 600,000 folders.  I'm looking to use Powershell to filter this huge file based on a search string, in this case, the search string would be a certain domain user.  What I want Powershell to do is find the search string in the original file and output it every instance of it  along with the immediate 10 lines above where it was found a new text file.  I hope this makes sense.  Thanks.
Avatar of Dale Harris
Dale Harris
Flag of United States of America image

Here's what I found for you:

$FilePath = "D:\powershell\stuff\*.*"
select-string -pattern "Guido"  -path $FilePath -context 10

I used it from http://www.computerperformance.co.uk/powershell/powershell_select_string.htm

Good luck!

DH
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'd like to ask for partial credit, points split, if I could between me and Qlemo.