View Single Post
Old 04-11-2008   #3 (permalink)
Brandon Shell [MVP]
Guest


 

Re: Parsing Text File and returning variables

Take a look at this entry http://bsonposh.com/modules/wordpress/?p=59

I did something very similar to what your looking for.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

M> Hey, I need help with a problem I have working on a text file.
M> Basically what I want to do is find a way to search for a line
M> expression, and then pull out the next numeric value into a variable
M> to be stored in the script (I will then take all these variables and
M> upload them to a sql db).
M>
M> in other words, for the example below, I would like to search for
M> "product code" and then assign 7618 to a $ProdCode, find time and set
M> $TimeStamp = "02.05.47", etc.
M> I'm sure there's an easy way, I just can't figure it out!
M> #################################
M>
M> Product Code 7618 Time=
M> 02.05.47
M>
M> Order No. 190805 Date=
M> 10.25.2006
M>
M> D a t a P r i n t o u t
M>
M> Line Speed ........... 13.6 M/min
M>
M> Roll Speed ................. 13.4 M/min
M>


My System SpecsSystem Spec