Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Help parsing output of log file

$
0
0

Hi there, not very strong with powershell however I have pieced this together so far..

The output of the code is..

WORKSPACE#11.1.2.0] admin 3/13/14 5:04 PM
WORKSPACE#11.1.2.0] admin 3/13/14 5:14 PM
WORKSPACE#11.1.2.0] admin 3/13/14 5:17 PM
WORKSPACE#11.1.2.0] admin 3/13/14 5:41 PM
WORKSPACE#11.1.2.0] admin 3/13/14 6:23 PM
WORKSPACE#11.1.2.0] admin 3/13/14 6:27 PM
WORKSPACE#11.1.2.0] WACAROES 3/14/14 3:31 AM
WORKSPACE#11.1.2.0] WACAROES 3/14/14 4:38 AM

I am trying to replace and format the output like

WORKSPACE <tab> admin <tab> Date

Any suggestions are welcome, thank you.

$file1 = "Framework.log"
$search1 = "Logging on user"
$in = Get-Content $file1
$in | ? {($_ | Select-String -pattern $search1)} | foreach {($_ -split '\s+',15)[14..25]} | %{$line=$_.split(" ") ; write-host $line[0] $line[6] $line[8..11]}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>