473,326 Members | 2,104 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,326 software developers and data experts.

Searching text in a file

Hi,

assume that I am working with a data file like this
====================================Patran .bdf file for CAE
$ file management section
$ -----------------------
$ -------------------------
$ executive control section
$ -------------------------
SOL 103
TIME 100000
CEND
$ --------------------
$ case control section
$ --------------------
ECHO = NONE
METHOD = 1
DISP = ALL
PARAM,COUPMASS,1
PARAM,OLDSEQ,-1
$ -----------------
$ bulk data section
$ -----------------
BEGIN BULK
$
PARAM AUTOSPC YES
PARAM GRDPNT 0
$
EIGRL 1 1. 10000. 20 0
MASS
$ property definitions
PBARL 1 1 BAR
0.4 0.4
$ material definitions
MAT1 1 21.E+10 0.3 7800.
$ grid point definitions (HERE STARTS Note parantheses and contents are
not a part of the file!)
GRID 1 0 0.0 0. 0. 0 123456
GRID 2 0 0.1 0. 0. 0 345
GRID 3 0 0.2 0. 0. 0 345
GRID 4 0 0.3 0. 0. 0 345
GRID 5 0 0.4 0. 0. 0 345
GRID 6 0 0.5 0. 0. 0 345
GRID 7 0 0.6 0. 0. 0 345
GRID 8 0 0.7 0. 0. 0 345
GRID 9 0 0.8 0. 0. 0 345
GRID 10 0 0.9 0. 0. 0 345
GRID 11 0 1.0 0. 0. 0 345
$ element definitions
CBAR 1 1 1 2 0. 1. 0.
CBAR 2 1 2 3 0. 1. 0.
CBAR 3 1 3 4 0. 1. 0.
CBAR 4 1 4 5 0. 1. 0.
CBAR 5 1 5 6 0. 1. 0.
CBAR 6 1 6 7 0. 1. 0.
CBAR 7 1 7 8 0. 1. 0.
CBAR 8 1 8 9 0. 1. 0.
CBAR 9 1 9 10 0. 1. 0.
CBAR 10 1 10 11 0. 1. 0.
ENDDATA
===================================
and I would like to find where the grid point definitions start(marked
with $ sign) after that I will take the coordinates into
vectors(hopefully). I guess STL could help me and this way I would also
improve my STL knowledge.

I just wanted some advice before start coding this.

Thank you in advance, regards

Feb 25 '06 #1
1 2038
utab wrote:
assume that I am working with a data file like this
====================================Patran .bdf file for CAE
[..]
$ grid point definitions (HERE STARTS Note parantheses and contents
are not a part of the file!)
GRID 1 0 0.0 0. 0. 0 123456
[..]
===================================
and I would like to find where the grid point definitions start(marked
with $ sign) after that I will take the coordinates into
vectors(hopefully). I guess STL could help me and this way I would
also improve my STL knowledge.

I just wanted some advice before start coding this.


Use 'std::string' and 'std::ifstream' and 'std::getline'. Get a book
on the Standard library, or just study the manual on those three elements
of the library. You're bound to arrive at a solution if you know what
you want.

V
--
Please remove capital As from my address when replying by mail
Feb 25 '06 #2

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

Similar topics

3
by: hivie | last post by:
I have a problem that is causing me problems. I have a text file that stores 5 lines of crap (stuff that I dont need( for the user only)). After that there is data that is in three columns...
4
by: Michi | last post by:
I was wondering what the best solution is for making large numbers of TEXT (or BLOB?) fields searchable. For example, if I have a forum, what is the best way to be able to search for specific...
3
by: Paul H | last post by:
I have a text file that contains the following: ******************** __StartCustomerID_41 Name: Fred Smith Address: 57 Pew Road Croydon
1
by: Bud Dean | last post by:
I need to search files for given text. In particular, I'm searching dll's, exe's, asp, aspx and html pages. I am having difficulty converting the byte arrays to strings. The following code...
2
by: angus | last post by:
hello everybody, i'm having some problems searching a text file and then deleting the line. since i used fileopen(), i can use the eof() function to loop through the file, searching for the...
5
by: robinsiebler | last post by:
I have a batch of files that I am trying to search for specific text in a specific format. Each file contains several items I want to search for. Here is a snippet from the file: .......
7
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search...
4
by: Hunk | last post by:
Hi I have a binary file which contains records sorted by Identifiers which are strings. The Identifiers are stored in ascending order. I would have to write a routine to give the record given...
3
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
12
by: Alexnb | last post by:
This is similar to my last post, but a little different. Here is what I would like to do. Lets say I have a text file. The contents look like this, only there is A LOT of the same thing. () A...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.