string search within a large file..

S

SR

Hi Folks,

I have a quick question regarding the possibility of extracting specific
information from a text file, then performing calculations (average
delay/jitter/throughput) based on that data. I am using a program called
observer (network instruments) which captures data packets that are
transmitted across a network link.

Because the captured file size is on roughly 50MB and there is approximately
3000 packets, it will be a very big job sifting through the file for the
relevant information. If the relevant information, could be filtered from
each packet and then stored in an array or another text file, then this
would make the overall calculations easier. I have just started doing C++ as
a degree module and am not overly familar with exactly how to go about doing
this, however I think I have to use file streams and strstr to search for
the text?

Part of a data packet is displayed below.

Packet 1: 00:09:5B:68:ED:4C -> 00:09:5B:2F:B6:74
Destination Address: 00:09:5B:2F:B6:74
Source Address: 00:09:5B:68:ED:4C
Network: Ethernet, Frame type: ETHERTYPE, Protocol: 0x0800 IP
Frame network size including 4 bytes CRC: 1518
Time: 13h:29m 41.411 822s, Diff. time: (0.005983) Date: Sat Dec 06 2003
IP: 192.168.1.2 -> 192.168.1.1

The information i require from each packet is in brackets Diff. time:
(0.005983). Can anyone suggest anything or point me in the right direction /
reading materials?

Many thanks

Saeed
 
D

David Fisher

[snip]
Packet 1: 00:09:5B:68:ED:4C -> 00:09:5B:2F:B6:74
Destination Address: 00:09:5B:2F:B6:74
Source Address: 00:09:5B:68:ED:4C
Network: Ethernet, Frame type: ETHERTYPE, Protocol: 0x0800 IP
Frame network size including 4 bytes CRC: 1518
Time: 13h:29m 41.411 822s, Diff. time: (0.005983) Date: Sat Dec 06 2003
IP: 192.168.1.2 -> 192.168.1.1

The information i require from each packet is in brackets Diff. time:
(0.005983). Can anyone suggest anything or point me in the right direction /
reading materials?

Regular expressions in general:

http://directory.google.com/Top/Computers/Programming/Languages/Regular_Expressions/C_and_C++/

- which contains a pointer to:

http://www.oesterhelt.org/pcrs/

- which describes a "Perl compatible regular expression library", which can
be used to search for a regular expression and extract a matching field (see
manual page http://www.oesterhelt.org/pcrs/pcrs.3.html and look under
"Substitutes").

David F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top