header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Help parsing text file in powershell
Last Post 03 Jun 2008 01:23 PM by halr9000. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
Topic is locked
Author Messages
NathanWUser is Offline
New Member
New Member
Posts:3

--
02 Jun 2008 02:27 AM  

Hi All,

I was wondering if someone could help me find a way to parse a text file
that I have.  I use this file every month to do a report and the program only
outputs plain txt format, I would like to be able to parse the file and do
some operations like sum and max on the data.  Below is a cut down version of
the file:

#FILE#
Datasets:
Site: {Site}
Direction: 1 - North bound, A hit first., Lane: 0
Survey Duration: 10:30 Wednesday, 12 June 2002 => 12:08 Thursday, 25 July 2002
File: {File Path}
Identifier: 
Algorithm: 
Data type: 

Profile:
Filter time: 10:30 Wednesday, 12 June 2002 => 12:08 Thursday, 25 July 2002
Included classes: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
Speed range: 10 - 160 km/h.
Direction: North, East, South, West (bound)
Separation: All - (Headway)
Name: Factory default profile
Scheme:
Units: Metric (meter, kilometer, m/s, km/h, kg, tonne)

Column Legend:
 0  [Time]  24-hour time (0000 - 2359)
 1  [Total]  Number in time step
 2  [Vbin]  Speed bin totals
 3  [Mean]  Average speed
 4  [Vpp]  Percentile speed

 

* Wednesday, 12 June 2002
 Time  Total  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Mean   Vpp
                10    20    30    40    50    60    70    80    90   100   110   120   130   140   150          85
                20    30    40    50    60    70    80    90   100   110   120   130   140   150   160            
 1030      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1045      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1100      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1115      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1130      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1145      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1200      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1215      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1230      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1245      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1300      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1315      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1330      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1345      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -
 1400      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     -     -


* Thursday, 13 June 2002
 Time  Total  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Vbin  Mean   Vpp
                10    20    30    40    50    60    70    80    90   100   110   120   130   140   150                                    85
                20    30    40    50    60    70    80    90   100   110   120   130   140   150   160            
 0000      3     0     0     0     0     1     2     0     0     0     0     0     0     0     0     0                                               59.2     -
 0015      1     0     0     0     0     1     0     0     0     0     0     0     0     0     0     0                                               55.6     -
 0030      1     0     0     0     0     0     1     0     0     0     0     0     0     0     0     0                                               60.2     -
 0045      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0                                                 -     -
 0100      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0                                                -     -
 0115      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0  
 0130      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   
 0145      1     0     0     0     0     1     0     0     0     0     0     0     0     0     0     0                                                59.4     -
 0200      1     0     0     0     0     1     0     0     0     0     0     0     0     0     0     0                                                52.1     -
 0215      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0    
0230      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   
 0245      2     0     1     0     0     1     0     0     0     0     0     0     0     0     0     0                                                39.9     -
 0300      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0    
 0315      1     0     0     0     0     0     1     0     0     0     0     0     0     0     0     0                                                63.8     -
 0330      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0    
 0345      1     0     0     0     0     1     0     0     0     0     0     0     0     0     0     0                                                52.0     -
 0400      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0    
 0415      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0  
 0430      1     0     1     0     0     0     0     0     0     0     0     0     0     0     0     0                                                28.0     -
 0445      3     0     0     0     1     0     1     1     0     0     0     0     0     0     0     0                                                64.1     -
 0500      4     0     0     0     1     2     1     0     0     0     0     0     0     0     0     0                                                54.2     -
 0515      7     0     0     0     1     3     3     0     0     0     0     0     0     0     0     0                                                56.9     -
 0530      4     0     0     0     1     1     2     0     0     0     0     0     0     0     0     0                                                57.3     -
 0545      8     0     0     1     1     3     3     0     0     0     0     0     0     0     0     0                                                55.5     -
 0600      8     0     0     0     2     2     2     2     0     0     0     0     0     0     0     0                                                61.8     -
 0615      4     0     0     0     1     2     0     1     0     0     0     0     0     0     0     0                                                55.5     -
 0630     13     0     0     0     4     5     3     1     0     0     0     0     0     0     0     0                                              55.6  60.1
 0645     11     0     0     0     0     5     3     3     0     0     0     0     0     0     0     0                                              62.9  70.2

#END FILE#

The data that I really need is all the stuff in between the dates, I would really like to be able to make an object with properties for each column heading so that I can sum and average the data.

I have attached a more complete file to the message

Thanks
Nathan


Attachment: 161282875071.txt

NathanWUser is Offline
New Member
New Member
Posts:3

--
02 Jun 2008 02:45 AM  
Hmm my message dosn't seem to show up :(


halr9000User is Online
Basic Member
Basic Member
Posts:303

--
02 Jun 2008 01:07 PM  
Ugh, this has happened before. I'll see what I can do.


halr9000User is Online
Basic Member
Basic Member
Posts:303

--
03 Jun 2008 01:23 PM  
I've re-posted the contents of this as a new post which is located here.


Topic is locked

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer