Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

search certain string in a TXT file 1

Status
Not open for further replies.

korper

Mechanical
Oct 11, 2001
15
Hi, group,

I want to find a string in a TXT file and return the content after it. It may go like this (i suppose)

OPEN (123, FILE="my_FILE.txt",...)
FIND "searching words is:"
GET WORDS after it and store as MY_var

Any hints are appreciated and thanks!

I am a newbie of fortran, where can i find more discription about FILE operation & string<=>nummer operation in FORTRAN with examples?
I am using intel fortran 8.1 of Linux
 
Replies continue below

Recommended for you

Try this
Code:
character*256 line
integer where
...
10    read (123, '(A)', end = 20) line
      where = index (line, 'searching words is:')
      if (where .ne. 0) then
          print *, line(where:)
      endif
      goto 10
20    continue
      close (123)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor