Hey Guys,
I have been racking the brains trying to think of the best way to programmatically do this, i'm trying to merge 2 .txt files into 1, but the problem is the way i do it a typical file looks like:
#furniture_field|furniture|etc|etc
FURNITURE
#!chairs|chairs[]|etc|etc
CHAIRS
#doors_fields|door|etc|etc
DOORS
#price|price_tag|new_prices
PRICE
etc
etc
The macros i.e. (the capitalised fields are pretty much all the same) only the fields above change like:
#prices|prices_tag|new_price
PRICE
#furniture_field|furniture|etc|etc
FURNITURE
#doors_field|doors|etc|etc
DOORS
#!chair|chair[]|etc|etc
CHAIRS
etc
etc
The macros aren't always in the same order so i can't even go line by line, ultimately i'm trying to merge them into one file like:
#prices|prices_tag|new_price|price|prices_tag
PRICE
#furniture_field|furniture|etc|etc
FURNITURE
#doors_field|doors|etc|etc
DOORS
#!chair|chair[]|door|etc|etc
CHAIRS
etc
etc
The fields are seperated with a "|" so i could split them up and check for duplicates before adding to the master.txt file, so far i have:
This just read one line at a time, i can't think of the best way to do this lol
any tips or help would be appreciated :)
cheers guys
Graham
I have been racking the brains trying to think of the best way to programmatically do this, i'm trying to merge 2 .txt files into 1, but the problem is the way i do it a typical file looks like:
#furniture_field|furniture|etc|etc
FURNITURE
#!chairs|chairs[]|etc|etc
CHAIRS
#doors_fields|door|etc|etc
DOORS
#price|price_tag|new_prices
PRICE
etc
etc
The macros i.e. (the capitalised fields are pretty much all the same) only the fields above change like:
#prices|prices_tag|new_price
PRICE
#furniture_field|furniture|etc|etc
FURNITURE
#doors_field|doors|etc|etc
DOORS
#!chair|chair[]|etc|etc
CHAIRS
etc
etc
The macros aren't always in the same order so i can't even go line by line, ultimately i'm trying to merge them into one file like:
#prices|prices_tag|new_price|price|prices_tag
PRICE
#furniture_field|furniture|etc|etc
FURNITURE
#doors_field|doors|etc|etc
DOORS
#!chair|chair[]|door|etc|etc
CHAIRS
etc
etc
The fields are seperated with a "|" so i could split them up and check for duplicates before adding to the master.txt file, so far i have:
Code:
Try
'// READ FILE #1
Dim File1 As New IO.StreamReader(txtBoxXas1.Text)
Dim FileData1 As String = File1.ReadToEnd()
File1.Close()
'// READ FILE #2
Dim File2 As New IO.StreamReader(txtBoxXas2.Text)
Dim FileData2 As String = File2.ReadToEnd()
File2.Close()
'// DECLARE VARIABLES
Dim File1Data As String() = FileData1.Split()
Dim File2Data As String() = FileData2.Split()
For x = 0 To UBound(File1Data)
If File1Data(x) <> File2Data(x) Then
Else
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
any tips or help would be appreciated :)
cheers guys
Graham