Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

txt file in array - how to process data?

$
0
0

Hi there,

I'm trying to convert a vbs file into powershell.
What the vbs does is read the entire txt file into an array, and then process several checks on the text by using the array.

In powershell I'm stuck on checking for a value on a line, and if present, get the time at the beginning of the same line.

The line in the txt file / array:
00 00 20:00:14 The batch date is 22-07-2013

Working vbs code:
If InStr(LCase(y),"the batch date is") Then
         sStartTime = Left(Right(y,37),8)
End If 

The resuilt would be that sStartTime has the value of "20:00:14".

So how do I accomplish this in powershell?

Thanks in advance,
Gibson

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles