I have a tab delimited text file as so :
name \t loan period \t loan amount
John \t 5 years \t 6000
Sarah \t 5 years \t 6000
Jane \t 1 month \t 100
I'm looking to copy the lines where "loan period" = "5 years" to where "loan period" = "1 month", in order to show the comparison. The new lines would be appended at the end of the resulting file.
The ultimate end result I hope to achieve is this :
name \t loan period \t loan amount
John \t 5 years \t 6000
Sarah \t 5 years \t 6000
Jane \t 1 month \t 100
John \t 1 month \t 100
Sarah \t 1 month \t 100
I've been toying about this with Visual Basic .Net, and so far, this is what I've come up with
Dim strData As String
Dim i As Short
Dim strLine() As String
lngSize = 0
FileOpen(1, txtloanlistinput.Text, OpenMode.Input)
While Not EOF(1)
i = i + 1
strData = LineInput(1)
End While
FileClose(1)
ReDim loanlist(i)
strData = ""
lngSize = i
i = 0
FileOpen(2, txtloanlistinput.Text, OpenMode.Input)
While Not EOF(2)
i = i + 1
strData = LineInput(2)
If i = 1 Then
strData = LineInput(2)
End If
strLine = Split(strData, Chr(9))
loanlist(i).strName = strLine(0)
loanlist(i).strLoanPeriod = strLine(1)
loanlist(i).curLoanAmount = strLine(2)
End While
FileClose(1)
FileClose(2)
I'm drawing a blank as to how to proceed, and thought I'd ask for help.