Solved

textdata

Posted on 2004-10-19
2
166 Views
Last Modified: 2010-05-02
How can I open a text file that would have data like below and I only want to get certain data lines ( under system date) which has 33 line I dont want the numbers 1-33 to show just the data to the right . I need to break each line up to two numbers each show in a grid on a form or be able to take each of the two numbers do someting with it and write back to another file then do the same for each line (1-33) I hope I explained well enough.
Thanks



CONDITION DATA

1 0DF01917EB
2 1B19E21D1D
3 D52421C93A
4 1FBD3D1FB4
5 391FAB3823
6 A538219B38
7 1E92381C88
8 371C81361A
9 7B35197535
10 1D73342073
11 341E6F331C
12 6A331C6832
13 1A68321968
14 3217683217
15 693218693B
16 1969451869
17 4818694918
18 684A18684A
19 1868491868
20 4918694918
21 684918694A
22 18694E1869
23 4F18694E18
24 694E18694E
25 18694E1869
26 4F18695918
27 695A18695A
28 18695A1869
29 5918695918
30 6959186959
31 1869591869
32 5918695918
33 6959176859
34 1768591768
35 5917685415
36 675315665D
37 15665F1666
38 6117676217
39 66651A6665
40 1F67652467
41 652967651E
42 699F256DA3
43 1C74EA237F
44 14257EF427
45 7DD2247DCC
46 237ECD207A
47 CC196FCC14
48 66CB115DC5
49 0F55B60B4D
50 A50A4A9A0B
51 4A920C4A91
52 0D4A910E4A
53 900D4A900E
54 4A910E4991
55 0E49910E49
56 910F49920F
57 49930F4993
58 0F49940F49
59 940F48940E
60 48940E4889
61 0E48790E48
62 690D48590D
63 484B0E483C
64 0E482D0E49
65 1E0E490E0E
66 49FF0E49F1
67 0E48E50F48
68 DC0F48DB0F
69 48DA0F48D6
70 0F48CB0F48
71 C10F48C10F
72 48C00F48C0
73 0F48BE0F48
74 B80E48AC0E
75 489E0D4890
76 0D48810C48
77 6E0B485C0B
78 484F0B4846
79 0C48380D49
80 1A134F0A18
81 530A1A5609
82 1E5700295D
83 F4306BF432
84 750F2F7C21
85 2175090760
86 9E08656510
87 6C601172A6
88 1579CA187D
89 A0177D8814
90 7B88147989
91 13768D1571
92 8C13708C14
93 72B61E78D3
94 2979D6317A
95 C32A7A060A
96 6ED3066D05
97 0679090B86
98 CD1293BE19
99 94BB178E93
100 158C63148A
101 491885481B
102 8247278146
103 0A83D4098E
104 7911938911
105 958A13948B
106 1291A01490
107 B3188FC51E
108 91CE1C90D1
109 188ED4158C
110 E5138CF213
111 8BF71289FB
112 148402127E
113 07107A0E11
114 7512117118
115 116F1B146F
116 1E156F1215
117 6FEC166FCE
118 186FC2186F
119 C1176FC116
120 6FC1166FC1
121 156FC1156F
122 C1156FC116
123 6FC1176EC0
124 186EC0196F
125 C0196FC018
126 6FBF186FBF
127 176FBF176F
128 BE176FBE18
129 70BD186FBD
130 186FBD186F
131 BE1970BE19
132 70BE196FBF
133 186FC2176F
134 C3176FC417
135 6FC4166FC5
136 1670C51770
137 C41870C418
138 70C41870C4
139 1872C41875
140 C41879C318
141 7CC41880C6
142 1883CB1787
143 D0178AD216
144 8DD21692D3
145 1595D31799
146 D4189DD417
147 A1D416A4D8
148 17A8E618AC
149 F117B0FC15
150 B3FD16B7FE
151 16BBFE14BE
152 FE16C1FE15
153 C5F414C8E5
154 12CBD810CC
155 D710CDD60F
156 CED50FCFD5
157 10D1D40CD1
158 DA0BD5F30B
159 DA010ADD00
160 0AE01708E2
161 1F07E21F06
162 E21F06E21F
163 06E32007E3
164 1F07E31D06
165 E31A06E319
166 07E51C06E7
167 1E07E92006
168 EA1C06EC17
169 05EE1906F0
170 1906F21903
171 F217FF7990
172 1A7D13208B
173 8810952206
174 9E6B08AFF5
175 0AC46C06C3
176 9B10C7A61C
177 C6B322B7C2
178 23AAE81E9F
179 1616992318
180 92251C8A28
181 198428167F
182 25157B2512
183 7B24127B24
184 137C23147D
185 23167E231A
186 8022228222
187 1B82221782
188 2215822216
189 8323188323
190 1984241985
191 2318852315
192 8524148524
193 1783251782
194 2515822514
195 8226168126
196 16811F1682
197 1B1D821F19
198 8223178224

SYSTEM STATUS DATA
1 0035108F04000000258E18D100000DC7FFE000000000FFB0000007000040
2 00070000000000000000F74040000011196D017D0300FEFC09000701F207
3 12BE0000000020000000F7404000002EFF09FA09FB0E60C30D00E72D6C05
4 12D48000000020000000F7404000002C27EEF726031D60C8150004057708
5 141B8002000020000000F7404000002A9902FC0FFF0961EC1500F4CC8908
6 147F8002000000000000D7404000000A8A0A03070103F3110B0005009413
7 14818000000000000000F740400000088A08000A000401070A0005029413
8 15138000000000000000D74040000005D10903090203F3F90A000302901C
9 15168000000000000000F74040000005D1090209010301FD0A000302901C
10 1E9F800000000000000077404000000AD40F0211010300F40A000200D110
11 2158800000000000000076407000000C1871E47CE7060F0E0B0004FFF202
12 215980000000000000007600700000071878C376C20726F90C000100F102
13 215C80000000000000007640700000041854A97DB5053FE2070001FFF202
14 215D80000000000000007600700000041867917D950248EA0A0001FFF202
15 21658000000000000000760070000000186FAD7DB0013CEF0900FFFFF201
16 27A3108F04000040258E08CF001F78EF761076B000900000084057000040
17 1855000000000000000077404000000E2B160913070208130A000300DF0B
18 1A2600000000000000007600700000061878CA56C10028090C0001FEF003
19 1A33000000000000000076007000000118538C7C911C5DE60B00FFFFF001
20 00000000000000000000774070000008195BF87CFF0918D90A000300F107
21 00070000000000000000F7404000000E1964037B070404E90A0006FFF109
22 025F0000000000000000F74040208207A60902090202FFFD090003FF6F17
23 07BF0000000000000000F74440008208A70801090101FAFA0A0003FF6F16
24 07C50000000000000000F74040008208A707010B0102FBF80A0003FF6F16
25 080D0000000000000000F74040000007A60900090002F9050A0002FF6F18
26 0B660000000020000000F7404000002EA82503EEF8F560E00E00FB2A6D06
27 0BED0000000020000000D740400000166206030B030501FD0D0000FFBF0A
28 0BEE0000000000000000D7404000001562080309020402FC0D0001FFBF0A
29 0BEF0000000000000000F7404000001462080308020406010C0001FFBF0A
30 0F5C0000000020000000F74040000028E502EB10F00B61020700FB6B6103
31 0F770000000000000000F74040000026AD05CE0BD0075F111400E4D56B08
32 12FB0000000000000000F74040208207260801090101FD030A0002FF7416
33 13270000000000000000F74040000006260802090201F8FF0A0002FF7418

FAULT HISTORY DATA

1 0604
2 0200
3 1104
4 0100
5 FF2D
6 0102
7 092C
8 0102
9 092B
10 0102
11 092A
12 0102
13 131F
14 0000
15 1116
16 0100
17 FFFF
18 FFFF
19 FFFF
20 FFFF
21 FFFF
22 FFFF
23 FFFF
24 FFFF
25 FFFF
26 FFFF
27 FFFF
28 FFFF
29 FFFF
30 FFFF
31 FFFF
32 FFFF
33 80C3
34 80D3


I will use the below example

SYSTEM STATUS DATA
1 0035108F04000000258E18D100000DC7FFE000000000FFB0000007000040

It would split starting at
00 35 10 8F 04 00 all the way across then repeat next line

maybe read the line split like above take 00 convert it to someting then result in a textbox then next two numbers do the same all the way across the repeat next line or take every two number put in a datagrid then be able to highlight and convert each number to something

0
Comment
Question by:ddew
2 Comments
 
LVL 4

Accepted Solution

by:
ChenChen earned 50 total points
ID: 12345864

'to open and read a text file:

dim strLine as string
dim lLineCounter as long
open FILEPATH for input as #1

do while not eof(1)
lLineCounter = lLineCounter + 1
line input #1, strLine
loop

close #1


'to break up your example:
dim lpos as long
dim strLine as string
dim str as string

strLine = "1 0035108F04000000258E18D100000DC7FFE000000000FFB0000007000040"
lpos = instr(1,strLine," ") ' " " is a space
do while lpos <= len(strLine)
str=mid(strLine,lpos,2)
debug.print str
lpos = lpos + 2
loop

'to write back to a text file
dim str as string

str = "Hello Hello Hello!!!"
open FILE_PATH for output as #1
print #1, str
close #1
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now