I need some help splitting a string into 2 separate columns. I am using get-content to retrieve the data. However, there are no headers in the files I am using. This is what the files look like:
USER1 11/21/2013 13:59
USER2 11/21/2013 14:07
USER3 11/21/2013 14:10
USER3 11/21/2013 14:13
It is gathering the last logon times for users on a particular machine. I want to use get-content to retrieve the data and then turn it into an object with 2 columns, “User” and “Logon Date.”
I can retrieve the content without a problem, but it isn’t formatted nicely. Ultimately, I will be piping the object to out-gridview:
Get-Content \\SERVER\gpotest$\USERS\$Computer.txt | select -Last 10 | Out-GridView -OutputMode Multiple -Title "Logon for Last 5 Users"
Any ideas how I can split each line into 2 columns based on either the space between the user and the date or splitting where an integer starts (the date)? Any help will be greatly appreciated.