We help IT Professionals succeed at work.
Get Started

Need Help Powershell scraping a log file and Adding named regex captured matches to an array .

Andre P
Andre P asked
on
188 Views
Last Modified: 2015-12-21
Input
07/12/2001 Jane made 3 pies and stopped after 5 min
08/14/2002 Joe ate 9 apples and started in 20 seconds
   08/14/2002 Joe ate 9 apples and started in 20 seconds


output
Date.           Name   Action      Time.  units

07/12/2001 Jane.    Stopped.   5    min
08/14/2002. joe.      Started 20      seconds

I want to create an array which holds a row for each entry above . [Date Name ,Action,Time,units]
adding a row for each line.

I hope I am clear .
Do I use Select-String with my regex code whch matches the items ?
Or is this a job for get-content ?
I am new to powershell and just nailed the regex to get the named captures
Now I just dont know how to stick them into an array as they are matched ..
Comment
Watch Question
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 17 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE