search certain string in a TXT file
search certain string in a TXT file
(OP)
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
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
RE: search certain string in a TXT file
CODE
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)