Large Text File Parsing
I am using PHP Code:
Dim varText
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Large Text Parsing
I need help parsing through a heavy bit of text, here.
I need to parse through lines like this:
('1', '6', '', '0', 'Name', 'VALUE', '2006-06-12', 'email', '4', '', '', '', 'yim', '', 'address', 'aim', '1', '1', 'The Dogs Bollocks', '0', '1150125120', '0', '1155507211', '1155508600', '1155497659', '319', '10', '1', '0', '1', '0', '10', '0', '2263', '09-27-1989', '1989-09-27', '-1', '1', '', '0', '0', '0', '0', '-1', '48', '15', 'val', '0', '0', '0', '0', '0');
The bolded parts are what I need outputted, perferably into a format like so:
Name:Value:Val
Also -- there are multiple lines of code. Each one is on a new line. When the parsed text is outputted, I'd like it to be on seperate lines as well.
I've attempted this a few times, to no avail. Help?
Parsing Large Text Files
Hi,
I have to change a ASCII file with delimited texts. I used following code to achieve the purpose. It works all right with small files. But my usual files are extremely big with some files having 3 million lines. When I work with these large files, the program crashes. Can visual basic handle such big files? or it is because of my inefficient programming skills ?
many thanks in advance.
Private Sub Form_Load()
Dim fso As FileSystemObject
Dim fso2 As FileSystemObject
Dim txt As TextStream
Dim f As TextStream
Dim str, str2, str3 As String
Dim strLines() As String
Dim YourDelimiter As String, SecondDelimiter As String
Dim i As Integer
Dim CurrentLine() As String
YourDelimiter = "}"
SecondDelimiter = "}"
Set fso = New FileSystemObject
'open the text file in memory
Set txt = fso.OpenTextFile("c: est_input.txt", ForReading, False, TristateUseDefault)
str = txt.ReadAll
str2 = Replace(str, vbCrLf, " ", , , vbTextCompare)
str3 = Replace(str2, "{", "", , , vbTextCompare)
strLines = Split(str3, YourDelimiter, -1, vbTextCompare)
Set f = fso.OpenTextFile("c: est_output.txt", ForWriting, True)
For i = 0 To UBound(strLines)
CurrentLine = Split(str3, SecondDelimiter, -1, vbTextCompare)
f.WriteLine CurrentLine(i)
Next i
End Sub
Parsing LARGE Text Files...Speed Is What I Need!
I have a program that does what it is suposed to but it is too slow to be practical.
The purpose of the program is to analyze log files and:
----record counts for events in the file
----Gather Specs on certain lines of the file
----Record Current Specs for Certain Events
Attached is a Rich Text Document that explains the module in more detail along with the source code.
I would love to speed this thing up but do not know how.
Any help or ideas would be greatly appreciated.
Thanks...
Parsing A Large File
Hey,
I have a couple of large files that my program needs to parse.
The files are levels from a game, stored in '.map' format, which can be opened as a .txt file (it's just some text and numbers).
The levels contain 'entities' and 'brushes'. Brushes are like the world itself, houses, etc, they don't interest me. What I need are the entities with their properties.
The file will always look like this:
A sample:
Code:
// brush 2
{
( 8 -40 312 ) ( 8 -48 312 ) ( -8 -40 312 ) common/origin 0 0 0 0.5 0.5 0 0 0
( 8 -40 312 ) ( -8 -40 312 ) ( 8 -40 296 ) common/origin 0 0 0 0.5 0.5 0 0 0
( 8 -40 312 ) ( 8 -40 296 ) ( 8 -48 312 ) common/origin 0 0 0 0.5 0.5 0 0 0
( -8 -48 296 ) ( 8 -48 296 ) ( -8 -40 296 ) common/origin 0 0 0 0.5 0.5 0 0 0
( -8 -56 296 ) ( -8 -56 312 ) ( 8 -56 296 ) common/origin 0 0 0 0.5 0.5 0 0 0
( -8 -48 296 ) ( -8 -40 296 ) ( -8 -48 312 ) common/origin 0 0 0 0.5 0.5 0 0 0
}
}
// entity 2
{
"classname" "path_corner"
"origin" "0 -48 304"
"scriptname" "flagroom_gate_up"
"targetname" "flagroom_gate_up"
}
// entity 3
{
"classname" "path_corner"
"origin" "0 -48 -64"
"targetname" "flagroom_gate_down"
"scriptname" "flagroom_gate_down"
}
What I need now is to have VB open this file (that's working already) and then read it line by line and return an array with:
- the entity number ( entity 2 for exmaple will be "2")
- the 'targetname' (entity 2 will have targetname "flagroom_gate_up")
- the 'scriptname' (entity 2 will have scriptname "flagroom_gate_up")
A 2D array could do the trick for this I guess... I want one array to hold all entities.
I have figured out already that the easiest way for the program to see if it's looking at an entity would be:
- read next line
- see if it starts with "// entity"
- if no - go back to start
- if yes - store the number after "entity " and read the next line
- the next line will always be "{" so we don't need to check it, read the next line
- if the next line starts with "//" then we reached the next entity OR a brush.
- if the next line starts with " then we reached the properties of the entity and need to see if this entity has a "scriptname" or "targetname" and store their values.
And somehow put this in a loop till it has all entities...
I cannot get this to work properly...
Until now I have come up with this:
vb Code:
Private Sub ReadMapFile()Dim nFileNum As Integer, sNextLine As String, Found As IntegerDim intEntityNr As IntegerDim strKeyValue() As StringDim n As Integer Dim SecondApPos As Integer, ThirdApPos As Integer, LastApPos As IntegerDim lngth As Integer' Get a free file numbernFileNum = FreeFile ' Open Test.txt for input. App.Path returns the path your app is saved inOpen strWolfDir & "" & strMapName For Input As nFileNum ReDim strKeyValue(0 To 2, 10000) ' Read the contents of the fileDo While Not EOF(nFileNum) 'Read a line Line Input #nFileNum, sNextLine 'If first char is // entity then read next line If Left$(sNextLine, 9) = "// entity" Then lngth = Len(sNextLine) - InStrRev(sNextLine, " ") intEntityNr = Val(Right$(sNextLine, lngth)) 'Read next two lines Line Input #nFileNum, sNextLine Line Input #nFileNum, sNextLine 'If first char is " then entity found If Left$(sNextLine, 1) = Chr$(34) Then 'Entity found - read until next "//" Do While Left$(sNextLine, 1) = Chr$(34) If Mid$(sNextLine, 2, 9) = "classname" Or _ Mid$(sNextLine, 2, 10) = "scriptname" Or _ Mid$(sNextLine, 2, 10) = "targetname" Then 'Second " position: SecondApPos = InStr(2, sNextLine, Chr$(34)) ThirdApPos = InStr(SecondApPos + 1, sNextLine, Chr$(34)) LastApPos = InStr(ThirdApPos + 1, sNextLine, Chr$(34)) ' ReDim Preserve strKeyValue(0 To 2, UBound(strKeyValue, 2) + 1) strKeyValue(0, n) = Mid$(sNextLine, 2, SecondApPos - 2) 'KEY strKeyValue(1, n) = Mid$(sNextLine, ThirdApPos + 1, LastApPos - ThirdApPos - 1) 'VALUE strKeyValue(2, n) = intEntityNr 'ENTITY NUMBER n = n + 1 End if 'Read next line and increase n Line Input #nFileNum, sNextLine Loop' ReDim Preserve strKeyValue(0 To 2, UBound(strKeyValue, 2) - 1) End If End IfLoop ' Close the fileClose nFileNum'''ADD TO LISTBOXESDim I As IntegerFor I = 0 To n - 1' List1.AddItem strKeyValue(0, I) & " - Entity: " & strKeyValue(2, I)' List2.AddItem strKeyValue(1, I) & " - Entity: " & strKeyValue(2, I) List1.AddItem strKeyValue(2, I) & " - " & strKeyValue(0, I) & " - " & strKeyValue(1, I)NextEnd Sub
I'll try to explain it a bit...
The first part is to read the lines like I said above, check for a "/"
And also, at the end, I want to store it in 3 listboxes.
The entity number -- the scriptname -- the targetname
But i think I can figure that out myself once I can get all entities inside the array...
Can anyone help me with this?
Also, I would like to make it as fast as possible, and I think that reading a txt file that can get up to 20 MB line by line will take some time...
would it be possible to skip lines for exmaple? instead of just issueing a "Line Input" comment multiple times, which will still take time...?
Parsing Large Size Test File
Hi there,
Currently, I am working on a proj which need to parse the IIS Log File.
Unfortunately I am having problem to deal with teh huge size which is 200++ MB.
even a simple code shown below are giving me the System.OutOfMemory exception!
Code:
' Open file stream
Dim srLogFile As StreamReader = New StreamReader(FilePath)
' Read each single line
Dim singleLine As String = srLogFile.ReadLine()
While Not IsNothing(singleLine)
singleLine = srLogFile.ReadLine()
End While
' Close stream
srLogFile.BaseStream.Close()
srLogFile.Close()
I do try to run it on another machine which got 1 GB of RAM. Still the same. Any advice?
================
code for fun, for to code
================
Edited by - bobtiangVBcity on 12/28/2004 2:21:39 AM
Parsing Specific Text Pattern From A Text File And Save It On Excel Format
I just registered as a new member for this forum....i'm only starting to learn VB and hope i can get more information and tips from you guys. Anyone here can help me how to parse specific text pattern and save it on an Excel file?....
Example:
My text file would look like this:
-/--------------------------------------------------------/
Device_name : W8510HA7-BAN-C
Lot No. :14023562.1-Q45218.1
TestProgram :W8510A7_REV06_100C
S/W H/W QTY PCNT TEST ITEM
FAIL 12 25 12 10.00% Leakage Fail
FAIL 13 26 42 42.02% bandgap Test Fail
FAIL 14 27 100 70.11% scan_core Fail
-/---------------------------------------------------------/
I want to parse the value for the Device_name, Lot No., TestProgram and all others
like QTY and TEST ITEM into an predefined excel format( ex.A1evice_Name, A2:Lot No., ......etc).
I hope you can help....thanks!
Jhunne
Parsing Large Strings
I need to parse large memo fields into smaller strings with maximum lengths of X (set as a constant; 255 for example), and throw each string into an array. I want to break on full words only. So if a string with a length of 255 ends in the middle of a word, I want to come back from the end of it to the first space, and end that chunk there. Then pick up from there to grab the next chunk.
Note that I don't want to use the Split function, because the memo fields have large white spaces (consecutive spaces), which I need to preserve.
Any ideas or suggestions? Thanks for any assistance you can give me.!
Very Large Text File
What control would you suggest loading the entire text file (5mb +) into so the user can scroll through the file and view it unedited? (As read only)
Im using a listbox, but it takes awhile for it to load, any suggestions?
I would like to have the user be able to scroll through the data using their scroll wheel on the mouse, how do I implement that?
Lastly, how would I make a progress bar to show how far through the text file the program is? I was thinking I could go through the file first, have it count the number of lines, then just use simple VB graphics to fill up the bar based upon how many lines its gone through so far. Is there an easier way of doing this?
LArge Text File
I am opening a txt file and filtering out un wanted spaces. The file is approx 350 mb.
The program is hanging on the 1st line input statement. It is hung now or I would copy cut and paste the code. Why is that? Any suggestions on getting around this problem?
The code is something like this:
Open FileName for input as #1
Open OutputFileName for output as #2
While not eof(1)
line Input #1, strInput
' Filtering code here
wend
Close #2
Close #1
Thanks
LJ
2D Strings Compare Large Text File With Dat File
Hi
i am trying to compare a search a large server.log for listings stored in a dat file
one by one.
so
dat file listing like this
mr a
mr b
mr c
then look in the server log file line by line for mr a, mr b and then mr c then if say at line 20 a hit on mr c is found stop, perform a task then resume the search till the next hit or till the end of the log
also as the server log is constantly updated i want a way to remember last postition and only scan the new additions to the log not the whole thing over and over
not asking for some one to hand it to me on a plate as i want to learn this as i go but allmost idiot proof examples of code would be very much welcome
thanks again
Help Parsing A Text File For A Map In RPG
I would like to parse a text file similar to this:
0,0,5,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0
where as each zero will get it's place in an array based on it's position in the text file. So strArray(0,0)=0 and strArray(0,3)=5
any help would be excellent
file name is map.txt, Array is mbytArray()
Parsing A Text File...
I need help with a freeware application I am developing. This is the last step in the entire project for this version before I release it.
I need help parsing the following file: http://www.gay.com/messenger/config.txt
I need to get the roomlist parsed from it and formatted like this:
str###=RoomName (where ### is the actual room number.) Those lines will be merged into an existing INI file.
There are identifying markers indicating where the roomlist is... Each line defining a room number and name starts with |# and ends with a backslash. Have to be careful though because the backslash isn't unique in the roomlist to just the end of each line. Any help is greatly appreciated and will be acknowledged in the credits!
Thanks,
Todd
Parsing A Text File
Hi, every one. My first post so go easy on me
Im haveing difficulty getting selcted text from a txt file. this is in actual fact a html file but i have attached it as a txt file for your viewing. Im trying to parse out the artist and song names into an array.
its kina working. at the moment im using:
Code:
textdata = "C:Documents and SettingsChrisDesktop
awdata.txt"
hfile = FreeFile
Open textdata For Input As #hfile
sAll = Input$(LOF(hfile), hfile)
parsedata = "width=70 align=left><BR>"
arrAll = Split(sAll, parsedata)
itwo = 1
For itwo = 1 To UBound(arrAll)
sSet = arrAll(itwo)
enterdata itwo, sSet
Next itwo
Public Sub enterdata(Index As Integer, strIN As String)
Dim arrSet() As String
Dim myStr As String
arrSet = Split(strIN, vbCrLf)
myStr = arrSet(0)
listitema = Left(myStr, Len(myStr))
If itwo < 9 Then
gap = " "
Else
gap = ""
End If
list.ListItems.Add itwo, "", itwo + 1 & ". " & gap & listitema
End Sub
But when parsing the data i dont always get the end of the song becasue it interprets the line break and stops.
Please help if you know how to do this.
Thanks a lot.
Chris Rowe
Parsing A Text File
Hi Everyone,
I am hoping someone could help me with this problem. It is over my head.
I have a text file with data similar to the below list. I want to be able to enter a string of letters into a text box, and then search the right side of the text file for any matches. If there is a match, then I would like to display any matches in a list box.
Text File Data:
Quote:
\HILLLLE UJELLOU
\INTRINK
\IBAKUP
\MAI1 KKIBBER
\MAI2 FRAPPLES
\NICITY GKIOSK
\OAKL OBFRAPDILAR
\OWA QDIETERY
\PEABURG FRAPPLES
\PULKI
\RHS1
\RHS2
For example:
I type the sequence "FRAP" into a text box. Only the data on the right side of the text file is searched for any matches. Then in the listbox, the displayed matches should look like this:
Quote:
FRAPPLES PEABURG
FRAPPLES MAI2
OBFRAPDILAR OAKL
ANY help would GREATLY be appreciated
Parsing Text File
Hi all
Hey I'm trying to parse a text file and i have found some code. It works for printing the line with my keyword. But all i want is that keyword plus 3 or 4 charactors to the right of it.
I'm not sure if this is the write way of doing this.
Any help?
Reston
VB Code:
Private Sub Command1_Click()Dim ln As String, keyword As String: keyword = "F"Dim ff As Integer: ff = FreeFile ' Open App.Path & "
ifchwc.t" For Input As #ff Open "C:Nif2
if2chwc
ifchwc.t" For Input As #ff Do Until EOF(ff) Line Input #ff, ln If InStr(1, ln, keyword) Then 'Debug.Print ln Printer.Print ln End If ace = 77 Loop Close #ff End Sub
Parsing A Text File
Hi Everyone,
I have a text file with a list of user names (example1). I need to have the middle initial and "." removed from the end of each name. The problem is that not everyone has a middle initial and "." at the end. I would like the data to look like example2. Does anyone know how to parse this data? Any help would be greatly appreciated.
Example1:
Quote:
Doe, John F.
Smith, Harry U.
Harris, Franklin T.
Gerber, Justin Q.
Smith, Joe
Cork, Bill
Bosi, Tim Q.
Example2:
Quote:
Doe, John
Smith, Harry
Harris, Franklin
Gerber, Justin
Smith, Joe
Cork, Bill
Bosi, Tim
Parsing Text File
hi how to remove some text file with this format of Text File
Quote:
C:>easyload.ocx --getsms inbox 1 5
Location 1, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number : "+639170000119"
Sent : Wednesday, September 28, 2005 7:58:04 PM +0800
Name : "Sir addres mo lbc ko pada"
Coding : Default GSM alphabet
Remote number : "+639277780666"
Status : UnRead
testing sms
Location 2, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number : "+639170000116"
Sent : Wednesday, September 28, 2005 8:03:03 PM +0200
Name : "hello world"
Coding : Default GSM alphabet
Remote number : "+639155618198"
Status : UnRead
hello world
i like to remove the
Quote:
SMS message
SMSC number : "+639170000119"
Sent : Wednesday, September 28, 2005 7:58:04 PM +0800
Name : "Sir addres mo lbc ko pada"
Coding : Default GSM alphabet
Remote number : "+639277780666"
Status : UnRead
so it will become like this
Quote:
Location 1, folder "Inbox", SIM memory, Inbox folder
testing sms
also the same with the Location 2 and so on
Parsing A Text File...
ok, here goes, i've got the following code :
VB Code:
Line Input #1, FilesBreak = Split(File, " ")List1.AddItem sBreak(1)DoEventsLoop
That parses the text file for every space their is, BUT what do i put if i want it to parse every line of the text file ?
I.e.
textlines.txt
Name1
Name2
Name3
Name4
i want them to appear in a listbox when i open it throught the program, i have posted my code below, and now my entire source code, i need all the help i can get !!!
i've tried the HTML equivalent, i've searched google, i've tried allsorts, so ANY HELP would be great and i will defineitley positive rep you if you get it rght !
Thanks in advance !
Parsing A Text File
I am looking for a little help on parsing a text file. I have a *.txt file that has no set format, but I am looking to pull specific information out of it. Some information is in column format, some information is labeled in rows, and line breaks are placed in randomly. All of the information has a label prior to it if it is in row format and a label above it if it is in column format. I have no control over how the *.txt file is formatted. It is coming from a program that my organization uses and is copyrighted.
I am fairly new at opening and reading files and have hit the wall trying to figure this out on my own. Any help would be much appreciated
Thanks
Iceman
Help In Parsing A Text File
I have a Visual Basic problem. I am reading a text file and need to pull out
certain information and put into another text file.
I am searching for a variable and once I find that variable, I want all of
the information following that variable until the variable changes or until
EOF. The variable I want "OAC 47" is not always grouped together.
Generally, I have been able to find the first instance and the following
data, however, also get other codes (OAC 46 i.e.) at the end of the list.
This is an example of the WORD text file I am reading from followed by a
copy of the Code:
OAC 31 FC/APPR 30 OBAN/ASN 01 BA 04 PEC 91212
RCCC/ CC T DESCRIPT REPORT PAYMENTS ACCRUALS
MONTH TO DATE EXPENSE PREVIOUS EXPENSES
PROJ C ID HOURS AMOUNT HOURS AMOUNT
HOURS AMOUNT HOURS AMOUNT
N TOTAL 80.01 4,975.39 120.01 7,463.07
184.02 11,443.45 532.00 33,100.85
EMPL 99 1.00
1.00 1.00
OAC 47 FC/APPR 29 OBAN/ASN 40 BA PEC 65306
RCCC/ CC T DESCRIPT REPORT PAYMENTS ACCRUALS
MONTH TO DATE EXPENSE PREVIOUS EXPENSES
PROJ C ID HOURS AMOUNT HOURS AMOUNT
HOURS AMOUNT HOURS AMOUNT
326410 A OT PAY 41-51
18.00- 458.82- 380.00 9,710.76
PER PAY 01-21 400.00 7,599.20 600.00 11,398.79
920.00 17,478.15 2,640.00 49,822.24
HOL PAY 12-32
40.00 861.68
FERS 71 538.60 807.89
1,238.79 3,544.18
THRIFT 72 186.60 279.87
429.18 1,228.58
MEDI 90 107.62 161.41
240.85 858.78
H BEN 91 419.13 628.69
964.00 2,766.24
FEGLI 92 13.65 20.46
31.39 89.59
CSR 93 192.42 288.63
442.57 1,262.51
OASDI 94 301.10 451.65
675.12 2,366.87
A TOTAL 400.00 9,358.32 600.00 14,037.39
902.00 21,041.23 3,060.00 72,511.43
EMPL 99 5.00
5.00 5.00
PCN SH002LM4L NE4M40 VERSION 20010907 PAGE 44
OAC 46 FC/APPR 30 OBAN/ASN 06 BA 01 PEC 28021
RCCC/ CC T DESCRIPT REPORT PAYMENTS ACCRUALS
MONTH TO DATE EXPENSE PREVIOUS EXPENSES
PROJ C ID HOURS AMOUNT HOURS AMOUNT
HOURS AMOUNT HOURS AMOUNT
411010 A OT PAY 41-51
24.00 524.64
PER PAY 01-21 160.00 2,713.60 239.99 4,070.39
367.99 6,241.28 656.00 11,753.75
FERS 71 290.36 435.54
667.84 1,257.67
THRIFT 72 135.68 203.51
312.06 587.68
MEDI 90 38.40 57.59
88.30 167.47
H BEN 91 195.32 292.98
449.24 1,244.28
FEGLI 92 5.90 8.85
13.58 25.33
OASDI 94 164.22 246.33
377.72 716.01
A TOTAL 160.00
Help Parsing A Text File
I posted this to the VB.NET list and have yet to see it appear in my
inbox, so I am not sure it went through. Sorry for the cross-posting,
but I want to try to find a solution.
I am trying to get some Stock Market data from a web site, and parse
the information I need into a text file. Getting the source code is no
problem, and the RegEx expression works OK. BUT...
The text that I has the information I need is all on one line, with
multiple Stocks and prices contained in that line. I need to be able
to go through the line and find every Stock / price that it contains,
but if I use a StreamReader ReadLine() my Regex only finds the first
stock and price. I am concerned that reading a block might break at a
point that only gets part of the Stock or Price, and since the site is
dynamic I cannot be sure that setting a block length based on the
characters I can see today will work from one day to the next.
Is there a way to replace the "> < " in the original text with ">
VbCrLf < "? I have toyed with doing that and writing to a new file,
then doing a ReadLine() on the new file, but that takes a bit of time
to accomplish and the end user wants this to run as fast as possible.
Alternately is there a trick to get RegEx to go through the whole line
and match every instance of Stock / price that is there?
Or is there a better way to accomplish what I am trying to do? I am
open to suggestions, since I seem to have hit a brick wall on this. I
may be doing this the hard way because I do not know a better way to
do it.
Currently using VS 2008 and writing this in VB.
Thanks for any suggestions or ideas on how to proceed!
--
Mark Rider
http://commonsensesecurity.info
If you're not part of the solution, you're part of the precipitate.
- Henry J. Tillman
Text File Parsing
Hi,
I'm trying to parse the text file, which is of size more than 2mb. I'm
using the following sample code
Open "c:sim1.txt" For Input As #1
Do While Not EOF(1)
Input #1, Data
If (InStr(Data, "Summary")) Then
str = str & Data
End If
Loop
Close #1
str is a string.
the text file consists of more than 20000 lines. i need to read the
values from each of these 20000 lines and apply some business rules.
based upon the conditions that meet the business rules, i need to
classify the sim1.txt file into 4 different files. the problem i'm
facing is, it is taking lot of time to run this program. the above
code that is shown is without business rules, as this program itself
is taking lot of time. the same program that i have done in java is
taking very less time. can anybody suggest or give me ideas or
alternative solution to solve this problem.
Thanking you,
Regards,
Ratnakar Pedagani.
Text File Parsing
I'm looking for some application advice regarding text files. We have these very large text files that are used to assemble circuit boards. The majority of the information is related to parts placement, board dimensions etc. What we as a test group do is parse out the information we need and make a testability study on the product. This often takes many hours to get the data into a readable format. My question is, what application VB, MS Access,Excel, C, C++, TCL, or other is ideal for doing this type of file crunching?
Parsing A Text File.
Please do provide solution for the following question:
I would like to read a text file which looks like this:
===========================================================
Start Time : 2003-03-27 11:55
Application Name : CDINVWRLWW
Application Code : CDIN
Revision Number : 1
Period : 2003
Import File : Y:FortisDTSYSDATACOLDdataimportRLWW_INVOICE_SPOOL_20030323.DAT
File Size : 6422872
Output to Data Set : CDINVWRLWW
Compressed File : Y:FortisDTSYSDATACOLDdataCDINCDIN2003.001
Pages Processed : 1680
Records Processed : 1635
Lines Processed : 125348
End Time : 2003-03-27 11:55
===========================================================
Start Time : 2003-03-27 12:33
Application Name : CDINVWMENS
Application Code : MENS
Revision Number : 1
Period : 2003
Import File : Y:FortisDTSYSDATACOLDdataimportMENS_INVOICE_SPOOL_20030323.DAT
File Size : 30383808
Output to Data Set : CDINVWMENS
Compressed File : Y:FortisDTSYSDATACOLDdataMENSMENS2003.001
Pages Processed : 5282
Records Processed : 4627
Lines Processed : 400834
End Time : 2003-03-27 12:34
===========================================================
Start Time : 2003-05-13 12:22
Application Name : CDINVWRLWW
Application Code : CDIN
Revision Number : 1
Period : 2003
Import File : Y:FortisDTSYSDATACOLDdataimportRLWW_INVOICE_SPOOL_20030323.DAT
File Size : 6422872
Output to Data Set : CDINVWRLWW
Compressed File : Y:FortisDTSYSDATACOLDdataCDINCDIN2003.002
Pages Processed : 1680
Records Processed : 1635
Lines Processed : 127825
End Time : 2003-05-13 12:23
===========================================================
As you can see, each block is separated by '======='. I would like to store all this info in an array so that each chunk in put in a more user friendly format. And when the user presses the next button, the interface should show the next chunk.
As I won't be knowing the file location, I should first be prompted for the location of the file and then this info should be stored in an .INI file. This should be read when the app is loaded the next time so that the dialog box need not be prompted again.
Could you please give me ideas on where I should start and the resources as I am new to VB.
Thanks.
Parsing A Text File
I am working a program that reads in a text file and has to parse the first line for a certain value. I am using the FSO object model to open the file and read in the first line. I need to know how to search the line I have just read in for a value. Any help would be great.
Thanks
Reading A Large Text File
At about line 1,426 VB decides it doesn't want to read anymore. How can this be fixed?
Code:
Dim ff As Integer
Dim readme As String
ff = FreeFile
Open readmes_path & "" & frmReadmes.File1.FileName For Input As #ff
readme = Input(LOF(ff), ff)
Text1.Text = readme
Close #ff
Edit A Very Large Text File
Dear Guys,
I have a problem with a massive text file which has the following format:
xxxxxxxxx
xxxxxxxxx
xxxxxxx">
cccccccc
xxxxxxxxx
xxxxxxxxx
xxxxxxx">
cccccccc
xxxxxxxxx
xxxxxxxxx
xxxxxxx">
cccccccc
Basically I want this to end up being:
xxxxxxxxx
xxxxxxxxx
xxxxxxx">cccccccc
xxxxxxxxx
xxxxxxxxx
xxxxxxx">cccccccc
etc....
So every time there is a "> it should move the line after that right next to it using the delete or removing the line feed.
Please help as I havent used VB in quite a while and need help.
Thanks and Regards
Large Text File Import
I hope someone can help me with this: I have to import a text file (using a VBA code) which is more than 65536 rows long into Excel. Preferably, the macro has to split the text file in two and devide them over two worksheets. Any suggestions?
Slurp Large Text File!
How can I slurp a large text file (300Mb+) into a single variable. How can I make use of the variable length string's 2 Billion Characters?
Large Gaps In Text File
Hi, I have a basic program that writes records from text boxes to a file.
Each set of records start on a new line.
After I enter a couple of sets of data and check the text file I find that there is large gaps at the begging of each new line.
Could someone please look through my code to see if they can find why it is doing this?
vb Code:
Dim LineCount As Long, DataLine As String Option Explicit Private Type NoteRecord StaffID As String * 4 Title As String * 4 Fname As String * 20 Sname As String * 20 DOB As String * 10 Address As String * 50 Town As String * 50 PCode As String * 7 HPhone As String * 12 MPhone As String * 11 Email As String * 50 JStatus As String * 8 AType As String * 9 APassword As String * 50 End Type Private Sub cmdcreate_Click()Dim i As IntegerDim file_name As StringDim fnum As IntegerDim note_record As NoteRecordDim value As StringDim l As Integer Screen.MousePointer = 11 ' hour glass l = lblgetline + 1 ' Open the data file.file_name = App.Path If Right$(file_name, 1) <> "" Then file_name = file_name & "" file_name = file_name & "accounts.txt" fnum = FreeFile Open file_name For Random As fnum Len = Len(note_record) ' Save the records. For i = l To l note_record.StaffID = Trim(txtStaffID.Text) note_record.Title = Trim(cmbtitle.Text) note_record.Fname = Trim(txtfirstname.Text) note_record.Sname = Trim(txtsecondname.Text) note_record.DOB = Trim(cmbday.Text & "/" & cmbmonth.Text & "/" & cmbyear.Text) note_record.Address = Trim(txtaddress.Text) note_record.Town = Trim(txttown.Text) note_record.PCode = Trim(txtpostcode.Text) note_record.HPhone = Trim(txthomephone.Text) note_record.MPhone = Trim(txtmobilephone.Text) note_record.Email = Trim(txtemail.Text) note_record.JStatus = Trim(cmbjobstatus.Text) note_record.AType = Trim(cmbaccounttype.Text) note_record.APassword = Trim(txtpassword.Text) & vbCrLf Put #fnum, i + 1, note_record Next i ' Close the file. Close #fnum Screen.MousePointer = 0 CreateStaff.Hide End Sub Private Sub Form_Load() 'see how many lines are in the file to see where to put nextOpen App.Path & "/accounts.txt" For Input As #1Do Until EOF(1) Line Input #1, DataLine LineCount = LineCount + 1Looplblgetline.Caption = Str$(LineCount) Close 'adds user types to list boxcmbaccounttype.AddItem "Admin"cmbaccounttype.AddItem "Reception"cmbaccounttype.AddItem "Maid"cmbaccounttype.AddItem "Caretaker" End Sub
Thanks
Sorting A Large Text File
Hi, I have a text file with about 80,000 lines and I need to convert it to an other format. Converting is not a problem, but I have no idea how to sort the new text file in alphabetical order. A Listbox and Listview can't hold so many lines.
Thanks.
Sort Large Text File
Hello All
I am trying to do a sort on a very larger text file, approx 75 MB. I have implemented the code below, but I am having a problem copying the file at the end of the run, I get a 75 file access error. Is there a reason why I cannot copy the file even though I closed both of them?
By the way is there a better way of doing this beside a bubble sort?
Thanks Steve
VB Code:
Private Sub ProcessFile()Dim SortComplete As BooleanDim BeginRead As BooleanDim SrcFileNum As IntegerDim SrcFilePath As StringDim DesFileNum As IntegerDim DesFilePath As StringDim SrcString1 As StringDim SrcString2 As StringDim i As LongDim j As Long Do While SortComplete = False SrcFilePath = "c:Combined.txt" SrcFileNum = FreeFile Open SrcFilePath For Input As SrcFileNum SrcFilePath = "C: emp.txt" DesFileNum = FreeFile Open SrcFilePath For Output As DesFileNum j = j + 1 SortComplete = True BeginRead = True Do While Not EOF(1) DoEvents If BeginRead = True Then Line Input #SrcFileNum, SrcString1 Line Input #SrcFileNum, SrcString2 Else Line Input #SrcFileNum, SrcString2 End If BeginRead = False If SrcString1 < SrcString2 Then Print #DesFileNum, SrcString1 SrcString1 = SrcString2 Else Print #DesFileNum, SrcString2 SortComplete = False End If i = i + 1 If i Mod 1000 = 0 Then Debug.Print "Run: " & j & ", Line: " & i Loop Print #DesFileNum, SrcString1 Close #SrcFileNum Close #DesFileNum DoEvents FileCopy DesFilePath, SrcFilePath Loop End Sub
Very Large Text File Manipulation
I have a SQL script that I am including in my instalation that will create the database for our app.
In VB 6, I have a dialog that would allow the user to choose the name of hte database, server, etc.... and create the database, and then create configuration files.
However, the database script is roughly 30,000 lines. The VB app does not like me using an "Open" or a file scripting object call. It freezes up the computer. The code is correct though, when I use a smaller file ( 3000 or less lines) I have no real slow down whatsoever.
Any ideas?
Thanks!
-Jason
Reading Large Text File
thanks for trying guys but still hanging. STARMAN - that would make sense, how would i found this out or go about replacing the characters??
Searching In A Large Text File
Hello, I'd like to search for movie names in a large text file and return the matches. I know how to do it with predefined words, but what I'd like to do now is more complicated.
This is the code I normally use with predefined words.
Code:
Private Sub Command1_Click()
Dim sLines As String
Open "C:movielist.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, sLines
If InStr(1, sLines, "matrix") And InStr(1, sLines, "revolutions") Then
Text1.Text = Text1.Text & sLines & vbCrLf
End If
DoEvents
Loop
Close #1
End Sub
Now I have this in a textbox:
Code:
!search matrix revolutions final end
If "!search" is in the textbox, then the other words (excluding "!search") need to be used as search strings, but only if they are at least 4 characters. In this case "matrix", "revolutions" and "final".
I know I can find out if "!search" is in the textbox with the Left function and that I have to put the words in an array, but how do I only add the words with at least 4 characters to the array and how do I use the array to search in the text file?
Code:
Private Sub Command2_Click()
Dim strArray() As String
If Left(Text2.Text, 8) = "!search " Then
strArray = Split(Text2.Text, " ")
End If
End Sub
Finding Text In A Large File
Is there a way to find text within a large file (several megabytes)? I'm trying to find out if a chm file contains a topic, and it looks like the topics are listed at the top. Alternatively, if there is something that allows me to find this out, rather than open a dialog with "page not found" displayed, that would work to solve my problem.
Thanks in advance.
Displaying A Large Text File
I want to read a large text file and display it as a wordpad. How can I do this. I tried to display my file using notepad but it displays only part of it. I suspect this is due to a limitation in notepad. Any sample code would be much appreciated
Thanks in advance
Deepal
Large Text File Editor
At my job I need to view files to verify that the data is not corrupt, some of these files are very large(4 gigs or more sometimes) and I am limited to 2 gigs with text editors such as SlickEdit, etc. My first option was to find a suitable editor on the internet, but every one that I downloaded had a similar limitation, and the ones that were supposedly unlimited file size tried to load the whole file into memory, which doesn't work. So now I am thinking I will have to write my own editor that will only load portions at a time, view that portion, then load another portion and unload the previous. I would like to update the line count for each portion of the file. I only have a little over a year's experience programming, so I am not sure if this is out of my league. If any of you could steer me in the right direction, pertaining to how to only load a portion of the file into memory(I think VB has a 2 gig limit, so this will have to be done) I would greatly appreciate it.
Sean
Tab Delimited Text File Text Parsing
I have a query that I wrote and ran in SQL Analyzer which produces three columns of information from three different tables. I set Analyzer up to dump the contents of this query to a text file rather than in its grid. I now have a tab delimited text file with the three columns of information.
What I need to do now is read that text file in using Vb, and dump the contents of column one into Richtextbox1, column two into Richtextbox2 and column three into Richtextbox3. How would I go about doing that?
Parsing Large Files In Excess Of 5000 Lines
I am having problems parsing files in excess of 5000 lines.
I am comparing two files each dumped into a seperate array.
They are 18,549 lines long.
I have had this problem before. If I line by line parse files directly it works.
It appears I am overflowing into the code as the program stops prematurely.
Help Parsing This Recipe Text File
I need to be able to parse this format of text file where title is one variable, category is another, yield is another, all ingredients are in one, and instructions are in one. Any help appreciated, I've honestly been trying all night to get these different sections isolated. Also, the file has 100s of entries like this, one below the other. Thanks in advance.
---------- Recipe
Title: Carrot Cake
Categories: Cakes, Muffins
Yield: 12 servings
1 c Oil
1 ts Baking soda
1 c Sugar
1 ts Salt
1 c Brown sugar
1 ts Baking powder
1 ts Vanilla
2 ts Cinnamon
4 x Eggs
3 c Carrots; shredded
2 c Flour, whole wheat
1 c Walnuts; chopped
1/3 c Dry milk
In large bowl, blend oil and sugars on low until well mixed. Add vanilla.
Beat in eggs, one at a time, blending well after each addition. Stir
together dry ingredients and add to egg mixture until well blended. Stir
in walnuts and carrots by hand.
Pour batter into well greased and floured 10" tube pan or fluted pan. Bake
at 350f for 50-60 minutes. Cool in pan, then top with powdered sugar or
frosting of your choice.
-----
Text File Parsing And Replacing
I am attempting to write a program that will open a text file in this format
"first_name possible middle initial last_name " , "email","city","make","model","year","state","subscriber","date","prod uct_id
garbage garbage to be thrown out
possibly another product id"
The program then needs to separate first_name delete middle initial if it exists then separate last name as well. It thens needs to find the product id throw out all garbage that comes after the product id then find if there is another product_id
Any help/code/point in the right direction anyone can give me would be greatly appreciated.
Help Parsing A Non-delimited Text File
I have a text file that I need to export into excel or a comma delimited file. The file consists of a solid string of prices consisting of numbers and decimal points. The only way I can think to break it down is by finding the decimal point in the string advancing 2 digits for the cents(the price is not a fixed length throughout the file) parse it and keep repeating. Also the information represents columnar data,(i.e. there are 7 fields so after each 7th price a new line should be started to build the columns required. I'm sure this is quite simple but I've been away from programming too long for it to click. Any help is appreciated!
Parsing A Delimited Text File
I am trying to capture specific parts of a text file that is delimited with the "|" symbol and in lines that begins with "FT1".
ie. FT1 |A|B|C|This part is captured|D|E|F
The information will be in that segment every time but the number of lines there are will vary.
Any ideas?
Parsing A Text File... ? I'm Confused...
If I use this:
-------------------
Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As _
String, ByVal szFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
DownloadFile "http://www.test.com", "C: emp.txt"
----------------------
A) When opened in notepad or a textbox, the text will not have the carriage returns. They're displayed as hollow or solid squares (depending on the font).
B) If I load the text file into a variable and then use "MSGBOX", msgbox will actually use those carriage return symbols (so it looks right).
C) If I copy and paste the messgage box symbol into anything (even this post), the cursor will simply drop down a line.
If I try using this suggestion on the text file:
sExpression = test.Text
sResults = Replace(sExpression, Chr(?), Chr(13))
Even if I just try replacing a character like "A" with Chr(13) , the textfile will still just show a box (carriage return symbol).
My only goal is to somehow get the linebreaks to work so I can read in the text file line by line.
I have to take a guess the function is somehow causing the txt file to be written in an odd/primite way or something? I mean - I can cut and past the txt file into this forum message box and the carriage return symbols will become carriage returns..... Surely the problem has to be the "format" or encoding "type" of the output text file from the DownloadFile function???
-----------
Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As _
String, ByVal szFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
DownloadFile "http://www.test.com", "C: emp.txt"
----------------
bong bong bong...... (that's my head banging against the wall)
Thanks for any help
Parsing Code Text File
Hi,
i have some text to parse. The text looks like this
If( X=2)
{
command "arg1",$arg2,arg3,(arg4)
}
I have to create a language and to code all keyword syntax such as The "command" syntax which would allow the user to add as many arg as possible with différent format. Code the fact that "if" is expecting condition and brackets...
Everybody who would give me advice, good site, books, or whatever about parsing would be a star !!!
thanks
Eire21
Bordeaux
France
Need Some Help Parsing A Delimited Text File
I need some help getting my program to open a delimited text file and placing the information in the correct text boxes.
i have the following in the txt files
†charles
Intro to Win2k adv serv§Basic Admin course 3 days
Intro to ISA Server§Basic ISA server Install and config course
†is used to seperate users records
then comes the course on a new line
and the § seperates the course from its description
i can get it to open the entire file for editing which is useless, i need to be able to send each peice, seperated by user to a different box, ie lists the users in a text box and when you click on a user it would update the crstxtbox and update the course and description. which need to be editable seperatly but saved together.
I also have two other small things.
I need to add in a new field for each record which is a small picture which is stored in a seperate directory. and when you open the record it open the image in a picture box, and if it doesn't have a picture listed in the record it leaves it blank or loads a default picture.
and since many of these courses are the same i need the 2nd text box seperated with a drop down in which you can select the course, but not be limited to selecting a known course and be able to enter a new course
I hope this makes some sense
If some of you nice guys out there could help me with this. Also if you post code for if you have a chance could you please also post comments in it to what each part does, otherwise I am just coping and pasteing, and I would like to learn wht I am putting in so I can do it on my own next time I have a question
thanks
KC
Parsing Text File Into Arrays
Hi
i have the following data in a text file called data.txt
abc 123 Program Files est.txt
def 456 Program Files est2.txt
I would like to load the info from the text file and put it in 3 arrays called letterArray() numberArray() and locationArray().
Does anybody know how i can seperate the 3 parts of information from the text file and place the data into the arrays
Cheers
eVBExplorer
|