Click here to Skip to main content
15,890,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have 2 raw *.txt files as shown:

1st Raw file for e.g:
MSIL
rtrwb1>telnet 10.130.224.91
Trying 10.130.224.91 ... Open

ENTER USERNAME < GNFMN1
ENTER PASSWORD < ******
MGW       MGW950199                 2010-10-21  19:18:54


                       WELCOME TO THE IPA2800 SERIES DIALOGUE


MAIN LEVEL COMMAND <___>
< ZOLT;

LOADING PROGRAM VERSION 6.18-0
MGW       MGW950199                 2010-10-21  19:18:55
SIGNALLING LINK LOAD
ACTIVE UNIT
METERS OF LAST PERIOD: 18:30:00 - 19:00:00 (30 MIN)
TDM BASED LINKS:
================
       RECEIVED   TRANSMITTED
  LINK ERLANGS    ERLANGS
  ==== ========== ===========
    2  0.133      0.136
    4  0.119      0.104
    5  0.039      0.057
    7  0.015      0.017
    8  0.030      0.031
    9  0.013      0.016
   10  0.120      0.095
   15  0.132      0.137
   24  0.132      0.137
   25  0.132      0.136
   26  0.132      0.137
   27  0.132      0.137
   28  0.132      0.137
   31  0.133      0.137
   32  0.137      0.139
   33  0.137      0.139
   34  0.137      0.139
   35  0.137      0.140
   36  0.138      0.139
   37  0.138      0.139
   38  0.138      0.140
   39  0.139      0.140
   49  0.030      0.033
   50  0.185      0.187
   51  0.186      0.187
   52  0.186      0.188
   53  0.186      0.188
   54  0.185      0.188
   55  0.186      0.188
   56  0.185      0.189
   57  0.185      0.187
   66  0.041      0.063
   70  0.044      0.071
   71  0.032      0.068
   72  0.065      0.108
   73  0.063      0.108
   74  0.073      0.000
   75  0.068      0.000
COMMAND EXECUTED

INTERROGATION OF SIGNALLING LINK STATISTICS METERS COMMAND <OL_>
<
INTERROGATION OF SIGNALLING LINK STATISTICS METERS COMMAND <OL_>
< ZZZZ;
END OF DIALOGUE SESSION



2nd raw file:
rtrwb1>telnet 10.130.224.91
Trying 10.130.224.91 ... Open




ENTER USERNAME < GNFMN1

ENTER PASSWORD < ******

MGW MGW950199 2010-10-22 19:16:16




WELCOME TO THE IPA2800 SERIES DIALOGUE





MAIN LEVEL COMMAND <___>
< ZNEL;


LOADING PROGRAM VERSION 8.38-0

MGW MGW950199 2010-10-22 19:16:17

SIGNALLING LINK STATES

TDM BASED LINKS (Q703)
======================
LINK LOG TERM EXTERN BIT
LINK LINK SET STATE UNIT TERM ETGR FUNCT PCM-TSL RATE
==== ======== ======= ============ ============ =======================
2 23 BSC99 AV-EX ISU-10 1 ETGR-75 0 399-16&&17 128
4 17 ASMSC AV-EX ISU-10 5 ETGR-24 0 192-16&&17 128
5 33 PRCCR AV-EX ISU-6 0 STER-3 0 2234-16 64
7 27 ATKMS AV-EX ISU-4 4 STER-1 2 1381-16 64
8 22 ATLM2 AV-EX ISU-3 2 ETGR-80 0 418-16 64
9 27 ATKMS AV-EX ISU-10 8 STER-1 3 1396-16 64
10 17 ASMSC AV-EX ISU-10 9 ETGR-68 0 368-16&&17 128
15 23 BSC99 AV-EX ISU-7 2 STER-2 0 2121-16&&17 128
24 23 BSC99 AV-EX ISU-6 3 STER-2 1 2125-16&&17 128
25 23 BSC99 AV-EX ISU-5 3 STER-2 2 2129-16&&17 128
26 23 BSC99 AV-EX ISU-8 0 ETGR-77 0 406-16&&17 128
27 23 BSC99 AV-EX ISU-1 3 ETGR-87 0 447-16&&17 128
28 23 BSC99 AV-EX ISU-10 6 ETGR-66 0 362-16&&17 128
30 33 PRCCR UA-AD ISU-7 3 STER-2 4 2104-16 64
31 23 BSC99 AV-EX ISU-3 4 ETGR-0 0 96-16&&17 128
32 25 ADL74 AV-EX ISU-3 6 ETGR-47 0 287-16&&17 128
33 25 ADL74 AV-EX ISU-7 4 ETGR-48 0 288-16&&17 128
34 25 ADL74 AV-EX ISU-3 7 ETGR-52 0 306-16&&17 128
35 25 ADL74 AV-EX ISU-9 1 ETGR-45 0 279-16&&17 128
36 25 ADL74 AV-EX ISU-5 0 ETGR-57 1 326-16&&17 128
37 25 ADL74 AV-EX ISU-3 8 STER-1 0 1351-16&&17 128
38 25 ADL74 AV-EX ISU-7 0 STER-1 1 1359-16&&17 128
39 25 ADL74 AV-EX ISU-0 1 ETGR-20 0 179-16&&17 128
49 22 ATLM2 AV-EX ISU-9 3 ETGR-81 0 422-16 64
50 26 BSC09 AV-EX ISU-7 1 ETGR-59 0 334-16&&17 128
51 26 BSC09 AV-EX ISU-3 5 ETGR-38 0 250-16&&17 128
52 26 BSC09 AV-EX ISU-4 2 ETGR-2 0 107-16&&17 128
53 26 BSC09 AV-EX ISU-3 9 ETGR-66 1 361-16&&17 128
54 26 BSC09 AV-EX ISU-5 2 STER-2 6 2136-16&&17 128
55 26 BSC09 AV-EX ISU-3 10 STER-2 5 2106-16&&17 128
56 26 BSC09 AV-EX ISU-3 11 ETGR-33 0 228-16&&17 128
57 26 BSC09 AV-EX ISU-6 2 ETGR-87 1 445-16&&17 128
59 - UA-AD ISU-7 5 STER-2 3 2149-16 64
SIGNALLING LINK NOT IN SIGNALLING LINK SET

66 28 RGMSC AV-EX ISU-5 1 ETGR-33 1 229-16 64
70 20 ANDMS UA-INS ISU-1 2 ETGR-64 0 355-16 64
71 20 ANDMS AV-EX ISU-9 4 ETGR-85 0 436-16 64
72 20 ANDMS AV-EX ISU-3 1 ETGR-34 0 235-15 64
73 20 ANDMS AV-EX ISU-7 6 ETGR-34 1 235-16 64
74 37 VODAO AV-EX ISU-7 7 ETGR-0 1 98-16 64
75 37 VODAO AV-EX ISU-6 1 ETGR-62 0 346-16 64

M3UA BASED LINKS
================
M3UA ASSOCIATION LINK
LINK LINK SET SET STATE
==== ======== =========== =====
0 16 MSSAS 0 AV-EX
1 18 MSSN0 1 AV-EX

COMMAND EXECUTED


SIGNALLING NETWORK STATE INTERROGATION COMMAND <NE_>
<

SIGNALLING NETWORK STATE INTERROGATION COMMAND <NE_>
< ZZZZ;

END OF DIALOGUE SESSION

In my form i need to show a 2 textboxes in which it would ask for a path for 2 raw file by clickage of a browse button.And on clickage of process button it should extract required data from 2 raw files & display the output as:

MSIL
RECEIVED   TRANSMITTED
  LINK ERLANGS    ERLANGS
  ==== ========== ===========
    2  0.133      0.136
    4  0.119      0.104
    5  0.039      0.057
    7  0.015      0.017
    8  0.030      0.031
    9  0.013      0.016
   10  0.120      0.095
   15  0.132      0.137
   24  0.132      0.137
   25  0.132      0.136
   26  0.132      0.137
   27  0.132      0.137
   28  0.132      0.137
   31  0.133      0.137
   32  0.137      0.139
   33  0.137      0.139
   34  0.137      0.139
   35  0.137      0.140
   36  0.138      0.139
   37  0.138      0.139
   38  0.138      0.140
   39  0.139      0.140
   49  0.030      0.033
   50  0.185      0.187
   51  0.186      0.187
   52  0.186      0.188
   53  0.186      0.188
   54  0.185      0.188
   55  0.186      0.188
   56  0.185      0.189
   57  0.185      0.187
   66  0.041      0.063
   70  0.044      0.071
   71  0.032      0.068
   72  0.065      0.108
   73  0.063      0.108
   74  0.073      0.000
   75  0.068      0.000

& 1 more column of Link Set form 2nd raw file.
Please help in the same



[orig. title]
VB Code to extract some parameters from 2 *.txt files & convert the same in single excel into 1 sheet by use of Browse Button & displaying output as per criteria required
Posted
Updated 16-Feb-11 1:23am
v2
Comments
Sandeep Mewara 16-Feb-11 2:11am    
Can you format your question properly. Avoid using spaces without need.

Use 'Improve Question' link.
Slacker007 16-Feb-11 7:24am    
Shortened original question title and removed extra white space.

1 solution

For the first file you search for " ==== ========== ===========" and take every line that starts with a number until you encounter "COMMAND EXECUTED" (or end of file).

For merging it with the second file:
First search for "==== ======== ======= ============ ============ =======================" and extract the text from there to "M3UA BASED LINKS", then you have two options:
1: Simply add each line starting with a number to the lines found in the first file.
2: Extract the first number of each line of the second file and find the matching number in file 2.

Good luck!



dim c as long, startline as long
dim lines as variant, arr as variant
lines = split(text, vbNewLine)
for c = 0 to ubound(lines)
  if lines(c) = "  ==== ========== ===========" then
    startline = c+1
    exit for
  end if
next
for c = startline to ubound(lines)
  arr = split(trim(lines(c)), " ")
  if isnumeric(arr(0)) then
     ' This is a line you want
  end if
next
 
Share this answer
 
v2
Comments
kom1234 18-Feb-11 2:52am    
Thanx...but exactly how to start with to match the characters and move ahead?
E.F. Nijboer 18-Feb-11 6:29am    
I updated the answer with some code that should get you started. This code is very straightforward but should give some idea on how to start. You might want to make it somewhat more forgivable by using the like operator (although it is somewhat slower).
kom1234 21-Feb-11 4:40am    
i still cant get the same
Espen Harlinn 17-Mar-11 10:27am    
Good effort - my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900