Alright so this is my first question here at stack. So i have the current code (Note im using c#)-
public static void ReadSuburbs()
{
String directory = @"C:\Address Sorting\";
String[] linesA = File.ReadAllLines(Path.Combine(directory, "FileA-Database.txt"));
String[] linesB = File.ReadAllLines(Path.Combine(directory, "Suburbs.txt"));
IEnumerable<String> onlyB = linesB.Intersect(linesA);
File.WriteAllLines(Path.Combine(directory, "ResultsSuburbs.txt"), onlyB);
}
What im trying to do is get all the suburbs from database a and print them exactly as they were in the text file. So ill just give you a example of a result i was looking to get.
Lets say my database a contained the street names
12 margret st kallangur
14 simpson st zillmere
43 pauls rd bowen hills
And the suburbs.txt contains a list of all suburbs in australia
The result im looking for would be
kallangur
zillmere
bowen hills
But what im getting is
Bowen HIlls
Kallangur
Zillmere
Is there another method i can use except intersect to get the result im looking for?
EDIT : So basically what i have is a database full of addresses that have been inputted incorrectly - So basically we have 12 saint street Kallangur and many other addresses in this database and what i need to do is seperate the suburbs from the street names.