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

Powershell parsing script

$
0
0

How hard would it be to use powershell and "parse" through a log file with the below raw data to return only the text User=data and awseg.

I have some code that I wrote that goes through a log file and returns "RAW DATA" below.

Initial Code:

$input_path = 'c:\users\egrounds\desktop\ex13071919.log'
$output_file = 'c:\users\egrounds\desktop\results.log'
select-string -path $input_path -pattern awseg > $output_file

RAW DATA:

ex13071919.log:58:2013-07-19   19:00:03 W3SVC1 EXCH7HT1 10.254.16.6 POST   /Microsoft-Server-ActiveSync/default.eas   User=STread&DeviceId=ApplC39GJX4JDTD5&DeviceType=iPhone&Cmd=Ping&Log=V121_Sst66_Sst32_LdapC0_LdapL0_RpcC42_RpcL62_
Hb600_Erq1_Pk1491414857_S2_ 443   brinker\STread 10.253.2.208 HTTP/1.1 Apple-iPhone4C1/1002.329   BIGipServerpool_https_exchange=101776906.47873.0000;+BIGipServerpool_https_awseg=74906890.47873.0000   - mobile.brinker.com 200 0 0 30

5 665 175044

DESIRED RESULTS:

User=Stread

Server=https_awseg

Thanks!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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