![]() |
Click here to advertise with us
|
|
|||||||
| VB.NET General Discussion VB.NET general discussion area |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi there,
I have many txt files, and i have to select any txt file to search and compare match fields with file: CompareText.txt. My text file format: 20090227#2#B010110100#3787.562904# 20090227#2#B010110200#430556.987989# 20090227#2#B010110213#2146515.91# 20090227#2#B010110211#14073.69# ...... CompareText.txt B010110200 B010110400 B010110413 B010110411 B010110213 , I can get the same result (depend on the third column to compare), then i must save this result to new txt file . Examples, this result from 2 txt files: 20090227#2#B010110200#430556.987989# 20090227#2#B010110213#2146515.91# Does anyone have code for this?? Thanks in advance Best Regards |
|
|||
|
Ok, so basically you want to return the whole line from the original text file if it has a match for the string you searched for?
I would do it like this:- 1.) Read the text file into an array of somekind - or step through one line at a time. 2.) loop through each element and see if it contains your search string. If it does contain the search string, then append that line onto another array 3.) once all lines have been searched against the search strings, write the array you created to a new file. Thats what springs to mind. I don't know the code off the top of my head so sorry I can't help anymore. Last edited by LeonR; 04-15-2009 at 4:49 PM. |
|
||||
|
Quote:
Use a Dictionary
__________________
DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ |
|
|||
|
Quote:
I think i'm still stuck in the old times!
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|