my text file look like this
------------------------------------------------------------------------------
AGILENT 3070 FIXTURE WIRING REPORT Sat Mar 07, 2009 06:43:05 PM
/var/hp3070/boards/Celestica/wbf303/fixture/wires
------------------------------------------------------------------------------
Fixture Type : Agilent SimPlate Express
Fixture Size : Bank 2
Fixture Part Number : 44200S
Top Probes Allowed : Enabled
Autofile : 28
Units : English
Wiring Method : Automatic
-----------------------------------------------------------------------------
( Pin ) [ Probe ] Length = in.
| From | To | From | To
Length|Ga|Color |(b r c )|(b r c )| X Y | X Y
------|--|------|---------------|---------------|-------|-------|-------|-------
1.0 30 Blue (2 15.00 28.0) [2 14.54 31.8] 94611 16275 88926 13049
1.0 30 Blue (2 15.00 29.0) [2 14.82 31.4] 93111 16275 89446 15049
1.0 30 Blue (2 15.00 30.0) [2 14.90 31.8] 91611 16275 88936 15569
------------------------------------------------------------------------------
AGILENT 3070 FIXTURE WIRING REPORT Sat Mar 07, 2009 06:43:05 PM
/var/hp3070/boards/Celestica/wbf303/fixture/wires
------------------------------------------------------------------------------
| From | To | From | To
Length|Ga|Color |(b r c )|(b r c )| X Y | X Y
------|--|------|---------------|---------------|-------|-------|-------|-------
6.5 30 Blue (2 22.00 42.0) [2 13.82 33.1] 73611 65275 86926 8049
6.5 30 Blue (2 21.00 18.0) [2 13.61 35.8] 109611 58275 82916 6549
7.0 30 Blue (2 22.00 17.0) [2 13.68 33.1] 111111 65275 86916 7049
I want to extract all the line which is 6.5 30 Blue (2 22.00 42.0) [2 13.82 33.1] 73611 65275 86926 8049
this kind line and write it in another file. I just want that kind of line without the headings everything. I also want the particular line number. this is my code so far
Dim FileContents() As String = IO.File.ReadAllLines(strFileName)
Dim sf As StreamWriter = File.CreateText("C:\match.txt")
For y As Integer = 0 To FileContents.GetUpperBound(0)
Dim patternStr As String = "\((\d \.)+\)"
Dim regexObj As New RegularExpressions.Regex(patternStr)
Dim matchColl As RegularExpressions.MatchCollection
matchColl = regexObj.Matches(FileContents(y))
If matchColl.Count > 0 Then
sf.WriteLine("{0}", matchColl(0).Value)
End If
Next
sf.Close()
But this code not writing anything in my file
I want to extract those lines according to value in ( ). can any one help me how can i solve this problem?
This post has been edited by kayatri: 07 August 2009 - 07:29 PM

New Topic/Question
Reply




MultiQuote




|