troubleshooting Question

powershell to find duplicate records in a text file and give me a sum of each duplicate record

Avatar of fireburn11
fireburn11 asked on
8 Comments2 Solutions3641 ViewsLast Modified:
hi all

I have a text file that contains 14000 IP addresses. there are 5680 unique IPs in the file.

I need a powershell script to look into the text file and tell me the sum of duplicate records for each unique IP.

basically, i am thinking a script that read the first line and compare it to the rest of IPs in the file and if there is a match, sum+=1, at the end, gives me the total sum of match, then move on to the second record , compare it with all rest of the IPs...

Can someone help?

"Batchelor", Developer and EE Topic Advisor
Join our community to see this answer!
Unlock 2 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros