473,385 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

string search within a large file..

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
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 09/02/2004
Jul 22 '05 #1
1 3005
"SR" <un*****@unknown.com> wrote:

[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/Comp...ons/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
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Anand Pillai | last post by:
To search a word in a group of words, say a paragraph or a web page, would a string search or a regexp search be faster? The string search would of course be, if str.find(substr) != -1:...
0
by: JF Potvin | last post by:
Hi ! I'm new to Perl and this group so any help is welcome. I've look around the groups a lot but I can't seems to find what I need. I have to do a script that connects to a specific web page...
3
by: Gerry Viator | last post by:
Hi all, I want to remove this : With a string function? Can I use the Astric as wild card? If not, how? Dim txtstr as String = "Print Report for MRN from B Database" txtstr =...
15
by: SK | last post by:
Hey folks, I am searching for a string (say "ABC") backwards in a file. First I seek to the end. Then I try to make a check like - do { file.clear (); file.get(c); file.seekg(-2,...
7
by: spike | last post by:
Im writing a program to search for a string in a binary file. And it works. The problem is: It is sooo slow! how can i make it faster? It takes 27 seconds just to search a 5 meg file. I guess it...
3
by: drum2001 | last post by:
Scenario: I have a database with user account information, including their status. Due to different circumstances, we disable these user accounts. First, we send them a warning e-mail and then...
33
by: Bertram Trabant | last post by:
Hello, Im working on a little LAN game in the style of old text-only MUD's and would need to find a way to search for a string in a text file (for example for usernames). I know it works in the way...
1
by: nganglove | last post by:
C++ string search -------------------------------------------------------------------------------- Hello, please can any one help me? I am given an assigment in C++ to read a text file and...
9
by: Clinto | last post by:
Hi, I am trying to find the fastest way to search a txt file for a particular string and return the line that contains the string. I have so for just used the most basic method. Initialized a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.