Hi everyone,
first - i dont know XML. My situation:
- i have text file "job_log.txt" , where new row is added few times per day:

1222275068.093750 ue 906.824559 ct 4.546900 fe 3000000000000.000000 nm w3_lhc_symmetric-q2_16__22__s__64.31_59.32__26_28__5__60_1_sixvf_boinc81281_1
1222275666.812498 ue 906.824559 ct 597.187500 fe 3000000000000.000000 nm w3_lhc_symmetric-q2_15__47__s__64.31_59.32__18_20__5__15_1_sixvf_boinc84095_2
1222275993.406248 ue 906.824559 ct 596.515600 fe 3000000000000.000000 nm w3_lhc_symmetric-q2_15__47__s__64.31_59.32__16_18__5__60_1_sixvf_boinc84093_4

- now i need extract first 10 digits from each row and count, how many of they are bigger than number X. (X is number from another XML)
- any idea ??
thank you

Now, where's your XML?

Anyway, first make a function to test "Is Bigger Than x"

Public Function IsBigger(ByVal OneLine As String, ByVal x As Integer) As Boolean
Dim TempStr As String

If OneLine.Length >= 10 Then
  TempStr = OneLine.Substring(0, 10)
     Value = CInt(TempStr)
     If Value > x Then
        Return True
        Return False
     End If
  Catch ex As Exception
    ' TempStr wasn't integer
    Return False
  End Try
  Return False
End If

End Function

and now count lines (pseudo code)

For Each Line In LinesOfMyFile
   If IsBigger(Line, x) Then
     Count += 1
   End If
' Output Count

This was (partly) in VB.NET but I think you'll get the idea.

This article has been dead for over six months. Start a new discussion instead.